Skip to content

Commit

Permalink
Use packaging.version to check version equality
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Nov 1, 2020
1 parent 5ee7caf commit 00f9234
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions news/9083.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
New resolver: Check version equality with ``packaging.version`` to avoid edge
cases if a wheel used different version normalization logic in its filename
and metadata.
5 changes: 3 additions & 2 deletions src/pip/_internal/resolution/resolvelib/candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,10 @@ def __init__(
)
# Version may not be present for PEP 508 direct URLs
if version is not None:
assert str(version) == wheel.version, (
wheel_version = Version(wheel.version)
assert version == wheel_version, (
"{!r} != {!r} for wheel {}".format(
version, wheel.version, name
version, wheel_version, name
)
)

Expand Down

0 comments on commit 00f9234

Please sign in to comment.