Skip to content

Commit

Permalink
Strip v prefix when using git tag as version number
Browse files Browse the repository at this point in the history
Released versions omitted the v prefix (to make proper semantic
versions), but version numbers autodetected from git would not, leading
to discrepancies. This fixes that.
  • Loading branch information
matthijskooijman committed Nov 19, 2023
1 parent 99cef05 commit e9a6a35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hamster/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def get_uninstalled_version():
from subprocess import getstatusoutput
rc, output = getstatusoutput("git describe --tags --always --dirty=+")
if rc == 0:
return output
import re
# Strip "v" prefix that is used in git tags
return re.sub(r'^v', '', output)
else:
from pathlib import Path
with open(Path(__file__).parent / 'VERSION', 'r') as f:
Expand Down

0 comments on commit e9a6a35

Please sign in to comment.