strip url: fix whl suffix, remove exe (#43344)

This commit is contained in:
Harmen Stoppels 2024-03-25 13:46:09 +01:00 committed by GitHub
parent 0c9a53ba3a
commit 9b046a39a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View file

@ -357,10 +357,8 @@ def strip_version_suffixes(path_or_url: str) -> str:
r"i[36]86", r"i[36]86",
r"ppc64(le)?", r"ppc64(le)?",
r"armv?(7l|6l|64)?", r"armv?(7l|6l|64)?",
# PyPI # PyPI wheels
r"[._-]py[23].*\.whl", r"-(?:py|cp)[23].*",
r"[._-]cp[23].*\.whl",
r"[._-]win.*\.exe",
] ]
for regex in suffix_regexes: for regex in suffix_regexes:

View file

@ -84,14 +84,15 @@ def test_get_bad_extension():
("astyle_1.23_macosx", "astyle_1.23"), ("astyle_1.23_macosx", "astyle_1.23"),
("haxe-2.08-osx", "haxe-2.08"), ("haxe-2.08-osx", "haxe-2.08"),
# PyPI - wheel # PyPI - wheel
("entrypoints-0.2.2-py2.py3-none-any.whl", "entrypoints-0.2.2"), ("wheel-1.2.3-py3-none-any", "wheel-1.2.3"),
("wheel-1.2.3-py2.py3-none-any", "wheel-1.2.3"),
("wheel-1.2.3-cp38-abi3-macosx_10_12_x86_64", "wheel-1.2.3"),
("entrypoints-0.2.2-py2.py3-none-any", "entrypoints-0.2.2"),
( (
"numpy-1.12.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel." "numpy-1.12.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel."
"macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", "macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64",
"numpy-1.12.0", "numpy-1.12.0",
), ),
# PyPI - exe
("PyYAML-3.12.win-amd64-py3.5.exe", "PyYAML-3.12"),
# Combinations of multiple patterns - bin, release # Combinations of multiple patterns - bin, release
("rocketmq-all-4.5.2-bin-release", "rocketmq-all-4.5.2"), ("rocketmq-all-4.5.2-bin-release", "rocketmq-all-4.5.2"),
# Combinations of multiple patterns - all # Combinations of multiple patterns - all