Skip to content

Commit 00b362e

Browse files
committed
MNT: Improve version determination on branches with digits
1 parent 6331852 commit 00b362e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

nibabel/_version.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
208208
# sorting will prefer e.g. "2.0" over "2.0rc1"
209209
if ref.startswith(tag_prefix):
210210
r = ref[len(tag_prefix):]
211+
# CJM: Nibabel fix to filter out refs that exactly match prefix
212+
# or that don't start with a number once the prefix is stripped
213+
# (Mostly a concern when prefix is '')
214+
if not re.match(r'\d', r):
215+
continue
211216
if verbose:
212217
print("picking %s" % r)
213218
return {"version": r,

versioneer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
629629
# sorting will prefer e.g. "2.0" over "2.0rc1"
630630
if ref.startswith(tag_prefix):
631631
r = ref[len(tag_prefix):]
632+
# CJM: Nibabel fix to filter out refs that exactly match prefix
633+
# or that don't start with a number once the prefix is stripped
634+
# (Mostly a concern when prefix is '')
635+
if not re.match(r'\d', r):
636+
continue
632637
if verbose:
633638
print("picking %%s" %% r)
634639
return {"version": r,
@@ -1029,6 +1034,11 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
10291034
# sorting will prefer e.g. "2.0" over "2.0rc1"
10301035
if ref.startswith(tag_prefix):
10311036
r = ref[len(tag_prefix):]
1037+
# CJM: Nibabel fix to filter out refs that exactly match prefix
1038+
# or that don't start with a number once the prefix is stripped
1039+
# (Mostly a concern when prefix is '')
1040+
if not re.match(r'\d', r):
1041+
continue
10321042
if verbose:
10331043
print("picking %s" % r)
10341044
return {"version": r,

0 commit comments

Comments
 (0)