Skip to content

Commit

Permalink
Fixed parsing of wheel file names with multiple platform tags
Browse files Browse the repository at this point in the history
Fixes #485.
  • Loading branch information
agronholm committed Nov 5, 2022
1 parent 6f1608d commit 4419390
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes
=============

**0.38.2 (2022-11-05)**

- Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with

This comment has been minimized.

Copy link
@mara004

mara004 Nov 5, 2022

Nit: Looking at the commit history, I think it was introduced in v0.38.0 already, but no one noticed, probably because that release got yanked quickly.

multiple platform tags

**0.38.1 (2022-11-04)**

- Removed install dependency on setuptools
Expand Down
2 changes: 1 addition & 1 deletion src/wheel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import annotations

__version__ = "0.38.1"
__version__ = "0.38.2"
4 changes: 2 additions & 2 deletions src/wheel/wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# Non-greedy matching of an optional build number may be too clever (more
# invalid wheel filenames will match). Separate regex for .dist-info?
WHEEL_INFO_RE = re.compile(
r"""^(?P<namever>(?P<name>[^-]+?)-(?P<ver>[^-]+?))(-(?P<build>\d[^-]*))?
-(?P<pyver>[^-]+?)-(?P<abi>[^-]+?)-(?P<plat>[^.]+?)\.whl$""",
r"""^(?P<namever>(?P<name>[^\s-]+?)-(?P<ver>[^\s-]+?))(-(?P<build>\d[^\s-]*))?
-(?P<pyver>[^\s-]+?)-(?P<abi>[^\s-]+?)-(?P<plat>\S+)\.whl$""",
re.VERBOSE,
)
MINIMUM_TIMESTAMP = 315532800 # 1980-01-01 00:00:00 UTC
Expand Down
14 changes: 11 additions & 3 deletions tests/test_wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ def wheel_path(tmpdir):
return str(tmpdir.join("test-1.0-py2.py3-none-any.whl"))


def test_wheelfile_re(tmpdir):
# Regression test for #208
path = tmpdir.join("foo-2-py3-none-any.whl")
@pytest.mark.parametrize(
"filename",
[
"foo-2-py3-none-any.whl",
"foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
],
)
def test_wheelfile_re(filename, tmpdir):
# Regression test for #208 and #485
path = tmpdir.join(filename)
with WheelFile(str(path), "w") as wf:
assert wf.parsed_filename.group("namever") == "foo-2"

Expand All @@ -29,6 +36,7 @@ def test_wheelfile_re(tmpdir):
"test-1.0-py2.whl",
"test-1.0-py2-none.whl",
"test-1.0-py2-none-any",
"test-1.0-py 2-none-any.whl",
],
)
def test_bad_wheel_filename(filename):
Expand Down

0 comments on commit 4419390

Please sign in to comment.