Skip to content

Commit 0555eea

Browse files
committed
Rename get_prefixed_libs() to get_isolated_environment_lib_paths()
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.
1 parent 19e8022 commit 0555eea

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/pip/_internal/build_env.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from pip import __file__ as pip_location
2020
from pip._internal.cli.spinners import open_spinner
21-
from pip._internal.locations import get_platlib, get_prefixed_libs, get_purelib
21+
from pip._internal.locations import get_platlib, get_isolated_environment_lib_paths, get_purelib
2222
from pip._internal.metadata import get_default_environment, get_environment
2323
from pip._internal.utils.subprocess import call_subprocess
2424
from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
@@ -37,7 +37,7 @@ def __init__(self, path: str) -> None:
3737
"nt" if os.name == "nt" else "posix_prefix",
3838
vars={"base": path, "platbase": path},
3939
)["scripts"]
40-
self.lib_dirs = get_prefixed_libs(path)
40+
self.lib_dirs = get_isolated_environment_lib_paths(path)
4141

4242

4343
def get_runnable_pip() -> str:

src/pip/_internal/locations/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"get_bin_user",
2828
"get_major_minor_version",
2929
"get_platlib",
30-
"get_prefixed_libs",
30+
"get_isolated_environment_lib_paths",
3131
"get_purelib",
3232
"get_scheme",
3333
"get_src_prefix",
@@ -482,13 +482,13 @@ def _looks_like_apple_library(path: str) -> bool:
482482
return path == f"/Library/Python/{get_major_minor_version()}/site-packages"
483483

484484

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

491-
old_pure, old_plat = _distutils.get_prefixed_libs(prefix)
491+
old_pure, old_plat = _distutils.get_isolated_environment_lib_paths(prefix)
492492
old_lib_paths = _deduplicated(old_pure, old_plat)
493493

494494
# Apple's Python (shipped with Xcode and Command Line Tools) hard-code

src/pip/_internal/locations/_distutils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def get_platlib() -> str:
173173
return get_python_lib(plat_specific=True)
174174

175175

176-
def get_prefixed_libs(prefix: str) -> Tuple[str, str]:
176+
def get_isolated_environment_lib_paths(prefix: str) -> Tuple[str, str]:
177177
return (
178178
get_python_lib(plat_specific=False, prefix=prefix),
179179
get_python_lib(plat_specific=True, prefix=prefix),

src/pip/_internal/locations/_sysconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def get_platlib() -> str:
213213
return sysconfig.get_paths()["platlib"]
214214

215215

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

0 commit comments

Comments
 (0)