From 333a5f18f469729d27620db5269638a6187958a6 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 29 Apr 2021 09:52:16 +0800 Subject: [PATCH] Remove the location warnings for now --- src/pip/_internal/locations/__init__.py | 65 +------------------------ 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/src/pip/_internal/locations/__init__.py b/src/pip/_internal/locations/__init__.py index 18bf0319f3d..e21e38e178c 100644 --- a/src/pip/_internal/locations/__init__.py +++ b/src/pip/_internal/locations/__init__.py @@ -1,10 +1,9 @@ import logging import pathlib -import sys import sysconfig from typing import List, Optional -from pip._internal.models.scheme import SCHEME_KEYS, Scheme +from pip._internal.models.scheme import Scheme from . import _distutils, _sysconfig from .base import ( @@ -85,51 +84,12 @@ def get_scheme( isolated=isolated, prefix=prefix, ) - new = _sysconfig.get_scheme( - dist_name, - user=user, - home=home, - root=root, - isolated=isolated, - prefix=prefix, - ) - - base = prefix or home or _default_base(user=user) - warned = [] - for k in SCHEME_KEYS: - # Extra join because distutils can return relative paths. - old_v = pathlib.Path(base, getattr(old, k)) - new_v = pathlib.Path(getattr(new, k)) - - # distutils incorrectly put PyPy packages under ``site-packages/python`` - # in the ``posix_home`` scheme, but PyPy devs said they expect the - # directory name to be ``pypy`` instead. So we treat this as a bug fix - # and not warn about it. See bpo-43307 and python/cpython#24628. - skip_pypy_special_case = ( - sys.implementation.name == "pypy" - and home is not None - and k in ("platlib", "purelib") - and old_v.parent == new_v.parent - and old_v.name == "python" - and new_v.name == "pypy" - ) - if skip_pypy_special_case: - continue - - warned.append(_warn_if_mismatch(old_v, new_v, key=f"scheme.{k}")) - - if any(warned): - _log_context(user=user, home=home, root=root, prefix=prefix) - return old def get_bin_prefix(): # type: () -> str old = _distutils.get_bin_prefix() - new = _sysconfig.get_bin_prefix() - if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="bin_prefix"): - _log_context() return old @@ -142,9 +102,6 @@ def get_purelib(): # type: () -> str """Return the default pure-Python lib location.""" old = _distutils.get_purelib() - new = _sysconfig.get_purelib() - if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="purelib"): - _log_context() return old @@ -152,9 +109,6 @@ def get_platlib(): # type: () -> str """Return the default platform-shared lib location.""" old = _distutils.get_platlib() - new = _sysconfig.get_platlib() - if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="platlib"): - _log_context() return old @@ -162,23 +116,6 @@ def get_prefixed_libs(prefix): # type: (str) -> List[str] """Return the lib locations under ``prefix``.""" old_pure, old_plat = _distutils.get_prefixed_libs(prefix) - new_pure, new_plat = _sysconfig.get_prefixed_libs(prefix) - - warned = [ - _warn_if_mismatch( - pathlib.Path(old_pure), - pathlib.Path(new_pure), - key="prefixed-purelib", - ), - _warn_if_mismatch( - pathlib.Path(old_plat), - pathlib.Path(new_plat), - key="prefixed-platlib", - ), - ] - if any(warned): - _log_context(prefix=prefix) - if old_pure == old_plat: return [old_pure] return [old_pure, old_plat]