Unbreak versioning on master
The mainline nightly should always have a `major.0-dev.nnn` format.
@@ -402,6 +402,15 @@ def get_version_from_scm(root: pathlib.Path) -> str:
re.X,
)
+ proc = subprocess.run(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
+ stdout=subprocess.PIPE,
+ universal_newlines=True,
+ check=True,
+ cwd=root,
+ )
+ branch = proc.stdout.strip()
+
proc = subprocess.run(
['git', 'tag', '--list', 'v*'],
stdout=subprocess.PIPE,
@@ -447,12 +456,17 @@ def get_version_from_scm(root: pathlib.Path) -> str:
ver = f'{major}.{minor}{microkind}{micro}{prekind}{preval}'
else:
# Dev/nightly build.
+ if branch.startswith("releases/"):
if prekind and preval:
pass
elif micro:
micro = str(int(micro) + 1)
else:
minor = str(int(minor) + 1)
+ else:
+ microkind = ''
+ micro = ''
+ minor = '0'
incremented_ver = f'{major}.{minor}{microkind}{micro}'
