|
1 | 1 | # The following comment should be removed at some point in the future.
|
2 | 2 | # mypy: strict-optional=False
|
3 | 3 |
|
4 |
| -import configparser |
5 | 4 | import contextlib
|
6 | 5 | import errno
|
7 | 6 | import getpass
|
8 | 7 | import hashlib
|
9 | 8 | import io
|
| 9 | +import logging |
10 | 10 | import os
|
11 | 11 | import posixpath
|
12 | 12 | import shutil
|
|
41 | 41 | from pip import __version__
|
42 | 42 | from pip._internal.exceptions import CommandError, ExternallyManagedEnvironment
|
43 | 43 | from pip._internal.locations import get_major_minor_version
|
44 |
| -from pip._internal.utils._log import VERBOSE, getLogger |
45 | 44 | from pip._internal.utils.compat import WINDOWS
|
46 | 45 | from pip._internal.utils.virtualenv import running_under_virtualenv
|
47 | 46 |
|
|
63 | 62 | "ConfiguredBuildBackendHookCaller",
|
64 | 63 | ]
|
65 | 64 |
|
66 |
| - |
67 |
| -logger = getLogger(__name__) |
| 65 | +logger = logging.getLogger(__name__) |
68 | 66 |
|
69 | 67 | T = TypeVar("T")
|
70 | 68 | ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
|
@@ -592,17 +590,11 @@ def check_externally_managed() -> None:
|
592 | 590 | raised.
|
593 | 591 | """
|
594 | 592 | if running_under_virtualenv():
|
595 |
| - return None |
| 593 | + return |
596 | 594 | marker = os.path.join(sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED")
|
597 | 595 | if not os.path.isfile(marker):
|
598 | 596 | return
|
599 |
| - parser = configparser.ConfigParser(interpolation=None) |
600 |
| - try: |
601 |
| - parser.read(marker, encoding="utf-8") |
602 |
| - except (OSError, UnicodeDecodeError): |
603 |
| - exc_info = logger.isEnabledFor(VERBOSE) |
604 |
| - logger.warning("Failed to read %s", marker, exc_info=exc_info) |
605 |
| - raise ExternallyManagedEnvironment.from_config(parser) |
| 597 | + raise ExternallyManagedEnvironment.from_config(marker) |
606 | 598 |
|
607 | 599 |
|
608 | 600 | def is_console_interactive() -> bool:
|
|
0 commit comments