Skip to content

Commit ca130c6

Browse files
committed
Clean up PEP 440 wheel filename deprecation language
1 parent ec5faea commit ca130c6

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

src/pip/_internal/models/wheel.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,15 @@ def __init__(self, filename: str) -> None:
4141
if "_" in _version:
4242
try:
4343
parse_wheel_filename(filename)
44-
except InvalidVersion as e:
45-
deprecated(
46-
reason=(
47-
f"Wheel filename version part {_version!r} is not correctly "
48-
"normalised, and contained an underscore character in the "
49-
"version part. Future versions of pip will fail to recognise "
50-
f"this wheel and report the error: {e.args[0]}."
51-
),
52-
replacement=(
53-
"rename the wheel to use a correctly normalised "
54-
"version part (this may require updating the version "
55-
"in the project metadata)"
56-
),
57-
gone_in="25.1",
58-
issue=12938,
59-
)
6044
except PackagingInvalidWheelName as e:
6145
deprecated(
6246
reason=(
63-
f"The wheel filename {filename!r} is not correctly normalised. "
64-
"Future versions of pip will fail to recognise this wheel. "
65-
f"and report the error: {e.args[0]}."
47+
f"Wheel filename {filename!r} is not correctly normalised. "
48+
"Future versions of pip will raise the following error:\n"
49+
f"{e.args[0]}\n\n"
6650
),
6751
replacement=(
68-
"rename the wheel to use a correctly normalised "
52+
"to rename the wheel to use a correctly normalised "
6953
"name (this may require updating the version in "
7054
"the project metadata)"
7155
),

tests/unit/test_models_wheel.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,10 @@ def test_version_underscore_conversion(self) -> None:
201201
with pytest.warns(deprecation.PipDeprecationWarning):
202202
w = Wheel("simple-0.1_1-py2-none-any.whl")
203203
assert w.version == "0.1-1"
204+
205+
def test_invalid_wheel_warning(self) -> None:
206+
"""
207+
Test that wheel with invalid name produces warning
208+
"""
209+
with pytest.warns(deprecation.PipDeprecationWarning):
210+
Wheel("six-1.16.0_build1-py3-none-any.whl")

0 commit comments

Comments
 (0)