From c0149d86df118fe718fc90ccfacf1b6d670393af Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Tue, 1 Nov 2022 23:43:22 +0100 Subject: [PATCH] Pkg: fix parsing versions (#15401) * testing * fix regex --- .actions/setup_tools.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.actions/setup_tools.py b/.actions/setup_tools.py index 9aab03d1d6..a8c00e7975 100644 --- a/.actions/setup_tools.py +++ b/.actions/setup_tools.py @@ -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"