Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable use of pip install --python for debundled pip #861

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/build/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import sysconfig
import tempfile
import typing
import warnings

from collections.abc import Collection, Mapping

Expand Down Expand Up @@ -158,6 +159,15 @@ def _has_valid_outer_pip(self) -> bool | None:
This checks for a valid global pip. Returns None if pip is missing, False
if pip is too old, and True if it can be used.
"""
# `pip install --python` is nonfunctional on Gentoo debundled pip.
# Detect that by checking if pip._vendor` module exists. However,
# searching for pip could yield warnings from _distutils_hack,
# so silence them.
with warnings.catch_warnings():
warnings.simplefilter('ignore')
if importlib.util.find_spec('pip._vendor') is None:
return False # pragma: no cover

# Version to have added the `--python` option.
return _has_dependency('pip', '22.3')

Expand Down
Loading