mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Prevent returning relative paths for a location
Our own override for the distutils implementation has a bug :)
This commit is contained in:
parent
6468908e94
commit
fcadb92b9e
|
@ -90,15 +90,6 @@ def _fix_abiflags(parts: Tuple[str]) -> Iterator[str]:
|
|||
yield part
|
||||
|
||||
|
||||
def _default_base(*, user: bool) -> str:
|
||||
if user:
|
||||
base = sysconfig.get_config_var("userbase")
|
||||
else:
|
||||
base = sysconfig.get_config_var("base")
|
||||
assert base is not None
|
||||
return base
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def _warn_mismatched(old: pathlib.Path, new: pathlib.Path, *, key: str) -> None:
|
||||
issue_url = "https://github.com/pypa/pip/issues/10151"
|
||||
|
@ -161,11 +152,9 @@ def get_scheme(
|
|||
prefix=prefix,
|
||||
)
|
||||
|
||||
base = prefix or home or _default_base(user=user)
|
||||
warning_contexts = []
|
||||
for k in SCHEME_KEYS:
|
||||
# Extra join because distutils can return relative paths.
|
||||
old_v = pathlib.Path(base, getattr(old, k))
|
||||
old_v = pathlib.Path(getattr(old, k))
|
||||
new_v = pathlib.Path(getattr(new, k))
|
||||
|
||||
if old_v == new_v:
|
||||
|
|
|
@ -81,8 +81,14 @@ def distutils_scheme(
|
|||
scheme.update(dict(purelib=i.install_lib, platlib=i.install_lib))
|
||||
|
||||
if running_under_virtualenv():
|
||||
if home:
|
||||
prefix = home
|
||||
elif user:
|
||||
prefix = i.install_userbase # type: ignore
|
||||
else:
|
||||
prefix = i.prefix
|
||||
scheme["headers"] = os.path.join(
|
||||
i.prefix,
|
||||
prefix,
|
||||
"include",
|
||||
"site",
|
||||
f"python{get_major_minor_version()}",
|
||||
|
@ -91,10 +97,7 @@ def distutils_scheme(
|
|||
|
||||
if root is not None:
|
||||
path_no_drive = os.path.splitdrive(os.path.abspath(scheme["headers"]))[1]
|
||||
scheme["headers"] = os.path.join(
|
||||
root,
|
||||
path_no_drive[1:],
|
||||
)
|
||||
scheme["headers"] = os.path.join(root, path_no_drive[1:])
|
||||
|
||||
return scheme
|
||||
|
||||
|
|
Loading…
Reference in a new issue