Skip to content

Commit

Permalink
Made wheel file name parsing more permissive
Browse files Browse the repository at this point in the history
Fixes #265.
  • Loading branch information
agronholm committed Oct 6, 2018
1 parent 826dff4 commit c84867f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release Notes
**UNRELEASED**

- Fixed build number appearing in the ``.dist-info`` directory name
- Made wheel file name parsing more permissive

**0.32.1**

Expand Down
4 changes: 2 additions & 2 deletions wheel/wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,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>\d.*?))(-(?P<build>\d.*?))?
-(?P<pyver>[a-z].+?)-(?P<abi>.+?)-(?P<plat>.+?)(\.whl|\.dist-info)$""",
r"""^(?P<namever>(?P<name>[\w\d.]+)-(?P<ver>[\w\d.]+))(-(?P<build>\d[\w\d.]*))?
-(?P<pyver>[\w\d.]+)-(?P<abi>[\w\d.]+)-(?P<plat>[\w\d.]+)\.whl$""",
re.VERBOSE)

This comment has been minimized.

Copy link
@KOLANICH

KOLANICH Oct 15, 2018

Replacing a . with [\w\d.] is useless!

This comment has been minimized.

Copy link
@agronholm

agronholm Oct 15, 2018

Author Contributor

If you do not otherwise see it, I will point out that the version component was far less permissive before. PEP 427 requires every component to be alphanumeric (with . added as an allowed character) and this regex reflects that. The problem you're having is that the generated file name contains a + which is not allowed in a wheel file name by PEP 427. The final question then remains: should bdist_wheel mangle the + into a _ or should the regex permit file names which PEP 427 does not?


Expand Down

0 comments on commit c84867f

Please sign in to comment.