Skip to content

Commit 23e40b6

Browse files
committed
feat(masonry): follow newer PyPA specification for wheel name
As per https://packaging.python.org/en/latest/specifications/binary-distribution-format/#binary-distribution-format, the specification replaces the original PEP 427 specification. The specification for the distribution name is https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode.
1 parent 2f26402 commit 23e40b6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/poetry/core/masonry/utils/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ def escape_version(version: str) -> str:
2929

3030

3131
def escape_name(name: str) -> str:
32-
"""Escaped wheel name as specified in :pep:`427#escaping-and-unicode`."""
33-
return re.sub(r"[^\w\d.]+", "_", name, flags=re.UNICODE)
32+
"""Escaped wheel name as specified in https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode."""
33+
return re.sub(r"[-_.]+", "_", name, flags=re.UNICODE).lower()

tests/masonry/utils/test_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def test_escape_version(version: str, expected: str) -> None:
2828
[
2929
("foo", "foo"),
3030
("foo-bar", "foo_bar"),
31-
("FOO-bAr", "FOO_bAr"),
32-
("foo.bar", "foo.bar"),
33-
("foo123-ba---.r", "foo123_ba_.r"),
31+
("FOO-bAr", "foo_bar"),
32+
("foo.bar", "foo_bar"),
33+
("foo123-ba---.r", "foo123_ba_r"),
3434
],
3535
)
3636
def test_escape_name(name: str, expected: str) -> None:

0 commit comments

Comments
 (0)