Skip to content

Commit 16efc01

Browse files
committed
Use variant_wheel_supported() on remaining codepaths
While technically it will still raise a `NotImplementedError` if `link` is not a local file, it will at least work fine with local files and non-variant wheels.
1 parent 3b7c959 commit 16efc01

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/pip/_internal/cache.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from pip._internal.models.wheel import Wheel
1717
from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
1818
from pip._internal.utils.urls import path_to_url
19+
from pip._internal.utils.variant import variant_wheel_supported
1920

2021
logger = logging.getLogger(__name__)
2122

@@ -150,8 +151,10 @@ def get(
150151
package_name,
151152
)
152153
continue
153-
raise NotImplementedError
154-
if not wheel.supported(supported_tags):
154+
if (
155+
not wheel.supported(supported_tags)
156+
or not variant_wheel_supported(wheel, link)
157+
):
155158
# Built for a different python/arch/etc
156159
continue
157160
candidates.append(

src/pip/_internal/resolution/legacy/resolver.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from pip._internal.utils.logging import indent_log
4747
from pip._internal.utils.misc import normalize_version_info
4848
from pip._internal.utils.packaging import check_requires_python
49+
from pip._internal.utils.variant import variant_wheel_supported
4950

5051
logger = logging.getLogger(__name__)
5152

@@ -225,8 +226,12 @@ def _add_requirement_to_set(
225226
if install_req.link and install_req.link.is_wheel:
226227
wheel = Wheel(install_req.link.filename)
227228
tags = compatibility_tags.get_supported()
228-
raise NotImplementedError
229-
if requirement_set.check_supported_wheels and not wheel.supported(tags):
229+
if (
230+
requirement_set.check_supported_wheels and (
231+
not wheel.supported(tags)
232+
or not variant_wheel_supported(wheel, install_req.link)
233+
)
234+
):
230235
raise InstallationError(
231236
f"{wheel.filename} is not a supported wheel on this platform."
232237
)

0 commit comments

Comments
 (0)