Skip to content

Commit

Permalink
Remove the location warnings for now
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Apr 29, 2021
1 parent 7a77484 commit 333a5f1
Showing 1 changed file with 1 addition and 64 deletions.
65 changes: 1 addition & 64 deletions src/pip/_internal/locations/__init__.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -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


Expand All @@ -142,43 +102,20 @@ 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


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


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]

0 comments on commit 333a5f1

Please sign in to comment.