diff --git a/src/poetry/utils/patterns.py b/src/poetry/utils/patterns.py index 717a569ddcd..5127e70ac7a 100644 --- a/src/poetry/utils/patterns.py +++ b/src/poetry/utils/patterns.py @@ -4,12 +4,12 @@ wheel_file_re = re.compile( - r"^(?P(?P.+?)-(?P\d.*?))" - r"(-(?P\d.*?))?" - r"-(?P.+?)" - r"-(?P.+?)" - r"-(?P.+?)" - r"\.whl|\.dist-info$", + r"^(?P(?P.+?)-(?P\d[^-]*))" + r"(-(?P\d[^-]*))?" + r"-(?P[^-]+)" + r"-(?P[^-]+)" + r"-(?P[^-]+)" + r"\.whl$", re.VERBOSE, ) diff --git a/tests/utils/test_patterns.py b/tests/utils/test_patterns.py index f3df7d52be6..daa8a483258 100644 --- a/tests/utils/test_patterns.py +++ b/tests/utils/test_patterns.py @@ -32,6 +32,18 @@ "plat": "manylinux2010_x86_64", }, ), + ( + "isort-metadata-4.3.4-py2-none-any.whl", + { + "namever": "isort-metadata-4.3.4", + "name": "isort-metadata", + "ver": "4.3.4", + "build": None, + "pyver": "py2", + "abi": "none", + "plat": "any", + }, + ), ], ) def test_wheel_file_re(filename: str, expected: dict[str, str | None]) -> None: