parent
1b56daf4f7
commit
c0149d86df
|
@ -54,11 +54,11 @@ def _augment_requirement(ln: str, comment_char: str = "#", unfreeze: str = "all"
|
|||
Returns:
|
||||
adjusted requirement
|
||||
|
||||
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # anything", unfreeze="")
|
||||
'arrow>=1.2.0, <=1.2.2'
|
||||
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # strict", unfreeze="")
|
||||
'arrow>=1.2.0, <=1.2.2 # strict'
|
||||
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # my name", unfreeze="all")
|
||||
>>> _augment_requirement("arrow<=1.2.2,>=1.2.0 # anything", unfreeze="")
|
||||
'arrow<=1.2.2,>=1.2.0'
|
||||
>>> _augment_requirement("arrow<=1.2.2,>=1.2.0 # strict", unfreeze="")
|
||||
'arrow<=1.2.2,>=1.2.0 # strict'
|
||||
>>> _augment_requirement("arrow<=1.2.2,>=1.2.0 # my name", unfreeze="all")
|
||||
'arrow>=1.2.0'
|
||||
>>> _augment_requirement("arrow>=1.2.0, <=1.2.2 # strict", unfreeze="all")
|
||||
'arrow>=1.2.0, <=1.2.2 # strict'
|
||||
|
@ -94,7 +94,7 @@ def _augment_requirement(ln: str, comment_char: str = "#", unfreeze: str = "all"
|
|||
|
||||
# remove version restrictions unless they are strict
|
||||
if unfreeze and "<" in req and not is_strict:
|
||||
req = re.sub(r",? *<=? *[\d\.\*]+", "", req).strip()
|
||||
req = re.sub(r",? *<=? *[\d\.\*]+,? *", "", req).strip()
|
||||
if ver_major is not None and not is_strict:
|
||||
# add , only if there are already some versions
|
||||
req += f"{',' if any(c in req for c in '<=>') else ''} <{int(ver_major) + 1}.0"
|
||||
|
|
Loading…
Reference in New Issue