Skip to content

Commit

Permalink
Rename get_prefixed_libs() to get_isolated_environment_lib_paths()
Browse files Browse the repository at this point in the history
Since this function is only used for creating isolated environments,
rename it to better describe what it does.  This avoids needing to
think about why the implementation uses the "venv" paths scheme even
when pip is not running in a virtual environment.
  • Loading branch information
dnicolodi committed Nov 16, 2022
1 parent 19e8022 commit 0555eea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from pip import __file__ as pip_location
from pip._internal.cli.spinners import open_spinner
from pip._internal.locations import get_platlib, get_prefixed_libs, get_purelib
from pip._internal.locations import get_platlib, get_isolated_environment_lib_paths, get_purelib
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 @@ -37,7 +37,7 @@ def __init__(self, path: str) -> None:
"nt" if os.name == "nt" else "posix_prefix",
vars={"base": path, "platbase": path},
)["scripts"]
self.lib_dirs = get_prefixed_libs(path)
self.lib_dirs = get_isolated_environment_lib_paths(path)


def get_runnable_pip() -> str:
Expand Down
8 changes: 4 additions & 4 deletions src/pip/_internal/locations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"get_bin_user",
"get_major_minor_version",
"get_platlib",
"get_prefixed_libs",
"get_isolated_environment_lib_paths",
"get_purelib",
"get_scheme",
"get_src_prefix",
Expand Down Expand Up @@ -482,13 +482,13 @@ def _looks_like_apple_library(path: str) -> bool:
return path == f"/Library/Python/{get_major_minor_version()}/site-packages"


def get_prefixed_libs(prefix: str) -> List[str]:
def get_isolated_environment_lib_paths(prefix: str) -> List[str]:
"""Return the lib locations under ``prefix``."""
new_pure, new_plat = _sysconfig.get_prefixed_libs(prefix)
new_pure, new_plat = _sysconfig.get_isolated_environment_lib_paths(prefix)
if _USE_SYSCONFIG:
return _deduplicated(new_pure, new_plat)

old_pure, old_plat = _distutils.get_prefixed_libs(prefix)
old_pure, old_plat = _distutils.get_isolated_environment_lib_paths(prefix)
old_lib_paths = _deduplicated(old_pure, old_plat)

# Apple's Python (shipped with Xcode and Command Line Tools) hard-code
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/locations/_distutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def get_platlib() -> str:
return get_python_lib(plat_specific=True)


def get_prefixed_libs(prefix: str) -> Tuple[str, str]:
def get_isolated_environment_lib_paths(prefix: str) -> Tuple[str, str]:
return (
get_python_lib(plat_specific=False, prefix=prefix),
get_python_lib(plat_specific=True, prefix=prefix),
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/locations/_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def get_platlib() -> str:
return sysconfig.get_paths()["platlib"]


def get_prefixed_libs(prefix: str) -> typing.Tuple[str, str]:
def get_isolated_environment_lib_paths(prefix: str) -> typing.Tuple[str, str]:
vars = {"base": prefix, "platbase": prefix}
if "venv" in sysconfig.get_scheme_names():
paths = sysconfig.get_paths(vars=vars, scheme="venv")
Expand Down

0 comments on commit 0555eea

Please sign in to comment.