mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Ignore header difference for osx_framework_user
This commit is contained in:
parent
77810bc9b4
commit
57d9af2c4f
3 changed files with 21 additions and 7 deletions
|
@ -11,6 +11,7 @@ from .base import (
|
|||
USER_CACHE_DIR,
|
||||
get_major_minor_version,
|
||||
get_src_prefix,
|
||||
is_osx_framework,
|
||||
site_packages,
|
||||
user_site,
|
||||
)
|
||||
|
@ -115,6 +116,19 @@ def get_scheme(
|
|||
if skip_pypy_special_case:
|
||||
continue
|
||||
|
||||
# sysconfig's ``osx_framework_user`` does not include ``pythonX.Y`` in
|
||||
# the ``include`` value, but distutils's ``headers`` does. We'll let
|
||||
# CPython decide whether this is a bug or feature. See bpo-43948.
|
||||
skip_osx_framework_user_special_case = (
|
||||
user
|
||||
and is_osx_framework()
|
||||
and k == "headers"
|
||||
and old_v.parent == new_v
|
||||
and old_v.name.startswith("python")
|
||||
)
|
||||
if skip_osx_framework_user_special_case:
|
||||
continue
|
||||
|
||||
warned.append(_warn_if_mismatch(old_v, new_v, key=f"scheme.{k}"))
|
||||
|
||||
if any(warned):
|
||||
|
|
|
@ -9,7 +9,7 @@ from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationI
|
|||
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
|
||||
from pip._internal.utils.virtualenv import running_under_virtualenv
|
||||
|
||||
from .base import get_major_minor_version
|
||||
from .base import get_major_minor_version, is_osx_framework
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -25,10 +25,6 @@ logger = logging.getLogger(__name__)
|
|||
_AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())
|
||||
|
||||
|
||||
def _is_osx_framework() -> bool:
|
||||
return sysconfig.get_config_var("PYTHONFRAMEWORK")
|
||||
|
||||
|
||||
def _infer_prefix() -> str:
|
||||
"""Try to find a prefix scheme for the current platform.
|
||||
|
||||
|
@ -43,7 +39,7 @@ def _infer_prefix() -> str:
|
|||
|
||||
If none of the above works, fall back to ``posix_prefix``.
|
||||
"""
|
||||
os_framework_global = _is_osx_framework() and not running_under_virtualenv()
|
||||
os_framework_global = is_osx_framework() and not running_under_virtualenv()
|
||||
if os_framework_global and "osx_framework_library" in _AVAILABLE_SCHEMES:
|
||||
return "osx_framework_library"
|
||||
implementation_suffixed = f"{sys.implementation.name}_{os.name}"
|
||||
|
@ -61,7 +57,7 @@ def _infer_prefix() -> str:
|
|||
|
||||
def _infer_user() -> str:
|
||||
"""Try to find a user scheme for the current platform."""
|
||||
if _is_osx_framework() and not running_under_virtualenv():
|
||||
if is_osx_framework() and not running_under_virtualenv():
|
||||
suffixed = "osx_framework_user"
|
||||
else:
|
||||
suffixed = f"{os.name}_user"
|
||||
|
|
|
@ -44,3 +44,7 @@ try:
|
|||
user_site: typing.Optional[str] = site.getusersitepackages()
|
||||
except AttributeError:
|
||||
user_site = site.USER_SITE
|
||||
|
||||
|
||||
def is_osx_framework() -> bool:
|
||||
return bool(sysconfig.get_config_var("PYTHONFRAMEWORK"))
|
||||
|
|
Loading…
Reference in a new issue