Skip to content

Commit 4419390

Browse files
committed
Fixed parsing of wheel file names with multiple platform tags
Fixes #485.
1 parent 6f1608d commit 4419390

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

docs/news.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Release Notes
22
=============
33

4+
**0.38.2 (2022-11-05)**
5+
6+
- Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with
7+
multiple platform tags
8+
49
**0.38.1 (2022-11-04)**
510

611
- Removed install dependency on setuptools

src/wheel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from __future__ import annotations
22

3-
__version__ = "0.38.1"
3+
__version__ = "0.38.2"

src/wheel/wheelfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# Non-greedy matching of an optional build number may be too clever (more
1717
# invalid wheel filenames will match). Separate regex for .dist-info?
1818
WHEEL_INFO_RE = re.compile(
19-
r"""^(?P<namever>(?P<name>[^-]+?)-(?P<ver>[^-]+?))(-(?P<build>\d[^-]*))?
20-
-(?P<pyver>[^-]+?)-(?P<abi>[^-]+?)-(?P<plat>[^.]+?)\.whl$""",
19+
r"""^(?P<namever>(?P<name>[^\s-]+?)-(?P<ver>[^\s-]+?))(-(?P<build>\d[^\s-]*))?
20+
-(?P<pyver>[^\s-]+?)-(?P<abi>[^\s-]+?)-(?P<plat>\S+)\.whl$""",
2121
re.VERBOSE,
2222
)
2323
MINIMUM_TIMESTAMP = 315532800 # 1980-01-01 00:00:00 UTC

tests/test_wheelfile.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ def wheel_path(tmpdir):
1414
return str(tmpdir.join("test-1.0-py2.py3-none-any.whl"))
1515

1616

17-
def test_wheelfile_re(tmpdir):
18-
# Regression test for #208
19-
path = tmpdir.join("foo-2-py3-none-any.whl")
17+
@pytest.mark.parametrize(
18+
"filename",
19+
[
20+
"foo-2-py3-none-any.whl",
21+
"foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
22+
],
23+
)
24+
def test_wheelfile_re(filename, tmpdir):
25+
# Regression test for #208 and #485
26+
path = tmpdir.join(filename)
2027
with WheelFile(str(path), "w") as wf:
2128
assert wf.parsed_filename.group("namever") == "foo-2"
2229

@@ -29,6 +36,7 @@ def test_wheelfile_re(tmpdir):
2936
"test-1.0-py2.whl",
3037
"test-1.0-py2-none.whl",
3138
"test-1.0-py2-none-any",
39+
"test-1.0-py 2-none-any.whl",
3240
],
3341
)
3442
def test_bad_wheel_filename(filename):

0 commit comments

Comments
 (0)