bro
This commit is contained in:
1 parent
de41a02749
commit
9af09cebd3
764 files changed
+54218
-78859
No files matched your search
@@ -41,13 +41,11 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
_PLATLIBDIR: str = getattr(sys, "platlibdir", "lib")
|
||||
|
||||
_USE_SYSCONFIG_DEFAULT = sys.version_info >= (3, 10)
|
||||
|
||||
|
||||
def _should_use_sysconfig() -> bool:
|
||||
"""This function determines the value of _USE_SYSCONFIG.
|
||||
|
||||
By default, pip uses sysconfig on Python 3.10+.
|
||||
By default, pip uses sysconfig.
|
||||
But Python distributors can override this decision by setting:
|
||||
sysconfig._PIP_USE_SYSCONFIG = True / False
|
||||
Rationale in https://github.com/pypa/pip/issues/10647
|
||||
@@ -55,7 +53,7 @@ def _should_use_sysconfig() -> bool:
|
||||
This is a function for testability, but should be constant during any one
|
||||
run.
|
||||
"""
|
||||
return bool(getattr(sysconfig, "_PIP_USE_SYSCONFIG", _USE_SYSCONFIG_DEFAULT))
|
||||
return bool(getattr(sysconfig, "_PIP_USE_SYSCONFIG", True))
|
||||
|
||||
|
||||
_USE_SYSCONFIG = _should_use_sysconfig()
|
||||
@@ -68,10 +66,10 @@ if not _USE_SYSCONFIG:
|
||||
|
||||
# Be noisy about incompatibilities if this platforms "should" be using
|
||||
# sysconfig, but is explicitly opting out and using distutils instead.
|
||||
if _USE_SYSCONFIG_DEFAULT and not _USE_SYSCONFIG:
|
||||
_MISMATCH_LEVEL = logging.WARNING
|
||||
else:
|
||||
if _USE_SYSCONFIG:
|
||||
_MISMATCH_LEVEL = logging.DEBUG
|
||||
else:
|
||||
_MISMATCH_LEVEL = logging.WARNING
|
||||
|
||||
|
||||
def _looks_like_bpo_44860() -> bool:
|
||||
@@ -281,7 +279,7 @@ def get_scheme(
|
||||
if k == "platlib" and _looks_like_red_hat_lib():
|
||||
continue
|
||||
|
||||
# On Python 3.9+, sysconfig's posix_user scheme sets platlib against
|
||||
# sysconfig's posix_user scheme sets platlib against
|
||||
# sys.platlibdir, but distutils's unix_user incorrectly continues
|
||||
# using the same $usersite for both platlib and purelib. This creates a
|
||||
# mismatch when sys.platlibdir is not "lib".
|
||||
|
||||
@@ -20,11 +20,10 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
from distutils.cmd import Command as DistutilsCommand
|
||||
from distutils.command.install import SCHEME_KEYS
|
||||
from distutils.command.install import install as distutils_install_command
|
||||
from distutils.sysconfig import get_python_lib
|
||||
|
||||
from pip._internal.models.scheme import Scheme
|
||||
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
|
||||
from pip._internal.utils.compat import WINDOWS
|
||||
from pip._internal.utils.virtualenv import running_under_virtualenv
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
import sysconfig
|
||||
from typing import Callable
|
||||
from collections.abc import Callable
|
||||
|
||||
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
|
||||
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
|
||||
@@ -158,6 +158,14 @@ def get_scheme(
|
||||
else:
|
||||
scheme_name = _infer_prefix()
|
||||
|
||||
# Special case: When installing into a custom prefix, use posix_prefix
|
||||
# instead of posix_local because it should *only* be used to redirecting
|
||||
# to /usr/local for system packager installs. Notably, posix_local is used
|
||||
# on Debian and its derivatives.
|
||||
# See also: https://discuss.python.org/t/18240
|
||||
if prefix is not None and scheme_name == "posix_local":
|
||||
scheme_name = "posix_prefix"
|
||||
|
||||
# Special case: When installing into a custom prefix, use posix_prefix
|
||||
# instead of osx_framework_library. See _should_use_osx_framework_prefix()
|
||||
# docstring for details.
|
||||
|
||||
@@ -41,7 +41,7 @@ def change_root(new_root: str, pathname: str) -> str:
|
||||
return os.path.join(new_root, pathname[1:])
|
||||
|
||||
elif os.name == "nt":
|
||||
(drive, path) = os.path.splitdrive(pathname)
|
||||
drive, path = os.path.splitdrive(pathname)
|
||||
if path[0] == "\\":
|
||||
path = path[1:]
|
||||
return os.path.join(new_root, path)
|
||||
|
||||
Reference in new issue
Block a user