Skip to content

Commit c0149d8

Browse files
authored
Pkg: fix parsing versions (#15401)
* testing * fix regex
1 parent 1b56daf commit c0149d8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.actions/setup_tools.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def _augment_requirement(ln: str, comment_char: str = "#", unfreeze: str = "all"
5454
Returns:
5555
adjusted requirement
5656
57-
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # anything", unfreeze="")
58-
'arrow>=1.2.0, <=1.2.2'
59-
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # strict", unfreeze="")
60-
'arrow>=1.2.0, <=1.2.2 # strict'
61-
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # my name", unfreeze="all")
57+
>>> _augment_requirement("arrow<=1.2.2,>=1.2.0 # anything", unfreeze="")
58+
'arrow<=1.2.2,>=1.2.0'
59+
>>> _augment_requirement("arrow<=1.2.2,>=1.2.0 # strict", unfreeze="")
60+
'arrow<=1.2.2,>=1.2.0 # strict'
61+
>>> _augment_requirement("arrow<=1.2.2,>=1.2.0 # my name", unfreeze="all")
6262
'arrow>=1.2.0'
6363
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # strict", unfreeze="all")
6464
'arrow>=1.2.0, <=1.2.2 # strict'
@@ -94,7 +94,7 @@ def _augment_requirement(ln: str, comment_char: str = "#", unfreeze: str = "all"
9494

9595
# remove version restrictions unless they are strict
9696
if unfreeze and "<" in req and not is_strict:
97-
req = re.sub(r",? *<=? *[\d\.\*]+", "", req).strip()
97+
req = re.sub(r",? *<=? *[\d\.\*]+,? *", "", req).strip()
9898
if ver_major is not None and not is_strict:
9999
# add , only if there are already some versions
100100
req += f"{',' if any(c in req for c in '<=>') else ''} <{int(ver_major) + 1}.0"

0 commit comments

Comments
 (0)