Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable location warning #10148

Merged
merged 1 commit into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/10151.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Re-enable the "Value for ... does not match" location warnings to field a new
round of feedback for the ``distutils``-``sysconfig`` transition.
12 changes: 9 additions & 3 deletions src/pip/_internal/locations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import functools
import logging
import os
import pathlib
import sys
import sysconfig
Expand Down Expand Up @@ -34,6 +35,11 @@

logger = logging.getLogger(__name__)

if os.environ.get("_PIP_LOCATIONS_NO_WARN_ON_MISMATCH"):
_MISMATCH_LEVEL = logging.DEBUG
else:
_MISMATCH_LEVEL = logging.WARNING


def _default_base(*, user: bool) -> str:
if user:
Expand All @@ -48,13 +54,13 @@ def _default_base(*, user: bool) -> str:
def _warn_if_mismatch(old: pathlib.Path, new: pathlib.Path, *, key: str) -> bool:
if old == new:
return False
issue_url = "https://github.com/pypa/pip/issues/9617"
issue_url = "https://github.com/pypa/pip/issues/10151"
message = (
"Value for %s does not match. Please report this to <%s>"
"\ndistutils: %s"
"\nsysconfig: %s"
)
logger.debug(message, key, issue_url, old, new)
logger.log(_MISMATCH_LEVEL, message, key, issue_url, old, new)
return True


Expand All @@ -69,7 +75,7 @@ def _log_context(
message = (
"Additional context:" "\nuser = %r" "\nhome = %r" "\nroot = %r" "\nprefix = %r"
)
logger.debug(message, user, home, root, prefix)
logger.log(_MISMATCH_LEVEL, message, user, home, root, prefix)


def get_scheme(
Expand Down