Skip to content

Commit 53ba3fb

Browse files
authored
Merge pull request #13012 from notatallshaw/clean-up-non-PEP-440-wheel-filename-deprecation-language
Clean up non PEP 440 wheel filename deprecation language
2 parents 6427eac + ca30217 commit 53ba3fb

File tree

3 files changed

+13
-24
lines changed

3 files changed

+13
-24
lines changed

news/13012.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clean up non PEP 440 wheel filename deprecation language.

src/pip/_internal/models/wheel.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
from typing import Dict, Iterable, List
77

88
from pip._vendor.packaging.tags import Tag
9-
from pip._vendor.packaging.utils import (
10-
InvalidVersion,
11-
parse_wheel_filename,
12-
)
139
from pip._vendor.packaging.utils import (
1410
InvalidWheelFilename as PackagingInvalidWheelName,
1511
)
12+
from pip._vendor.packaging.utils import parse_wheel_filename
1613

1714
from pip._internal.exceptions import InvalidWheelFilename
1815
from pip._internal.utils.deprecation import deprecated
@@ -41,31 +38,15 @@ def __init__(self, filename: str) -> None:
4138
if "_" in _version:
4239
try:
4340
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-
)
6041
except PackagingInvalidWheelName as e:
6142
deprecated(
6243
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]}."
44+
f"Wheel filename {filename!r} is not correctly normalised. "
45+
"Future versions of pip will raise the following error:\n"
46+
f"{e.args[0]}\n\n"
6647
),
6748
replacement=(
68-
"rename the wheel to use a correctly normalised "
49+
"to rename the wheel to use a correctly normalised "
6950
"name (this may require updating the version in "
7051
"the project metadata)"
7152
),

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)