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