Skip to content

Commit

Permalink
Reconcile computation of isolated build environment paths
Browse files Browse the repository at this point in the history
Use the same code to determine isolated environment paths at
dependency install time and at environment setup time. We do not care
about the exact paths but the paths needs to be consistent at package
installation time and environment setup.

This should fix all issues observed on platforms that customize the
installation schemes, such as Debian and Homebrew, where dependency
installation and isolated build environment setup resolved to
different paths.

See pypa#11598 and pypa#11623.
  • Loading branch information
dnicolodi committed Jan 21, 2023
1 parent 95a58e7 commit a11a29b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

from pip import __file__ as pip_location
from pip._internal.cli.spinners import open_spinner
from pip._internal.locations import (
get_isolated_environment_bin_path,
get_isolated_environment_lib_paths,
get_platlib,
get_purelib,
)
from pip._internal.locations import get_platlib, get_purelib, get_scheme
from pip._internal.metadata import get_default_environment, get_environment
from pip._internal.utils.subprocess import call_subprocess
from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
Expand All @@ -33,12 +28,17 @@
logger = logging.getLogger(__name__)


def _dedup(a: str, b: str) -> Tuple[str]:
return a, b if a != b else a,


class _Prefix:
def __init__(self, path: str) -> None:
self.path = path
self.setup = False
self.bin_dir = get_isolated_environment_bin_path(path)
self.lib_dirs = get_isolated_environment_lib_paths(path)
scheme = get_scheme("", prefix=path)
self.bin_dir = scheme.scripts
self.lib_dirs = _dedup(scheme.purelib, scheme.platlib)


def get_runnable_pip() -> str:
Expand Down

0 comments on commit a11a29b

Please sign in to comment.