Skip to content

Commit

Permalink
Tighten regular expression used to validate wheel filenames
Browse files Browse the repository at this point in the history
Drop the .dist-info file extension. Enforce that each component of the
filename does not contain a dash: dashes are used as separators.

See https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-name-convention

Remove spurious grouping, while at it.
  • Loading branch information
dnicolodi committed Dec 17, 2024
1 parent 0605ef0 commit 9ff643a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions twine/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
from twine import exceptions

wheel_file_re = re.compile(
r"""^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
\.whl|\.dist-info)$""",
r"""^(?P<name>[^-]+)-
(?P<version>[^-]+)
(:?-(?P<build>\d[^-]*))?-
(?P<pyver>[^-]+)-
(?P<abi>[^-]+)-
(?P<plat>[^-]+)
\.whl$""",
re.VERBOSE,
)

Expand Down

0 comments on commit 9ff643a

Please sign in to comment.