Skip to content

Commit 445711c

Browse files
authored
Merge pull request #8349 from uranusjr/new-resolver-reject-unsupported-wheel
2 parents b1d4fe9 + e7635b7 commit 445711c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/pip/_internal/index/package_finder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,11 @@ def create(
658658
ignore_requires_python=selection_prefs.ignore_requires_python,
659659
)
660660

661+
@property
662+
def target_python(self):
663+
# type: () -> TargetPython
664+
return self._target_python
665+
661666
@property
662667
def search_scope(self):
663668
# type: () -> SearchScope

src/pip/_internal/resolution/resolvelib/factory.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
from pip._internal.exceptions import (
88
InstallationError,
99
UnsupportedPythonVersion,
10+
UnsupportedWheel,
1011
)
12+
from pip._internal.models.wheel import Wheel
1113
from pip._internal.utils.compatibility_tags import get_supported
1214
from pip._internal.utils.hashes import Hashes
1315
from pip._internal.utils.misc import (
@@ -248,6 +250,13 @@ def make_requirement_from_install_req(self, ireq, requested_extras):
248250
return None
249251
if not ireq.link:
250252
return SpecifierRequirement(ireq)
253+
if ireq.link.is_wheel:
254+
wheel = Wheel(ireq.link.filename)
255+
if not wheel.supported(self._finder.target_python.get_tags()):
256+
msg = "{} is not a supported wheel on this platform.".format(
257+
wheel.filename,
258+
)
259+
raise UnsupportedWheel(msg)
251260
cand = self._make_candidate_from_link(
252261
ireq.link,
253262
extras=frozenset(ireq.extras),

tests/functional/test_install_reqs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ def test_install_unsupported_wheel_link_with_marker(script):
561561
assert len(result.files_created) == 0
562562

563563

564-
@pytest.mark.fails_on_new_resolver
565564
def test_install_unsupported_wheel_file(script, data):
566565
# Trying to install a local wheel with an incompatible version/type
567566
# should fail.

0 commit comments

Comments
 (0)