|
4 | 4 | import pathlib
|
5 | 5 | import sys
|
6 | 6 | import sysconfig
|
7 |
| -from typing import Any, Dict, Generator, List, Optional, Tuple |
| 7 | +from typing import Any, Dict, Generator, Optional, Tuple |
8 | 8 |
|
9 | 9 | from pip._internal.models.scheme import SCHEME_KEYS, Scheme
|
10 | 10 | from pip._internal.utils.compat import WINDOWS
|
|
25 | 25 | "USER_CACHE_DIR",
|
26 | 26 | "get_bin_prefix",
|
27 | 27 | "get_bin_user",
|
28 |
| - "get_isolated_environment_bin_path", |
29 |
| - "get_isolated_environment_lib_paths", |
30 | 28 | "get_major_minor_version",
|
31 | 29 | "get_platlib",
|
32 | 30 | "get_purelib",
|
@@ -467,67 +465,3 @@ def get_platlib() -> str:
|
467 | 465 | if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="platlib"):
|
468 | 466 | _log_context()
|
469 | 467 | return old
|
470 |
| - |
471 |
| - |
472 |
| -def _deduplicated(v1: str, v2: str) -> List[str]: |
473 |
| - """Deduplicate values from a list.""" |
474 |
| - if v1 == v2: |
475 |
| - return [v1] |
476 |
| - return [v1, v2] |
477 |
| - |
478 |
| - |
479 |
| -def _looks_like_apple_library(path: str) -> bool: |
480 |
| - """Apple patches sysconfig to *always* look under */Library/Python*.""" |
481 |
| - if sys.platform[:6] != "darwin": |
482 |
| - return False |
483 |
| - return path == f"/Library/Python/{get_major_minor_version()}/site-packages" |
484 |
| - |
485 |
| - |
486 |
| -def get_isolated_environment_lib_paths(prefix: str) -> List[str]: |
487 |
| - """Return the lib locations under ``prefix``.""" |
488 |
| - new_pure, new_plat = _sysconfig.get_isolated_environment_lib_paths(prefix) |
489 |
| - if _USE_SYSCONFIG: |
490 |
| - return _deduplicated(new_pure, new_plat) |
491 |
| - |
492 |
| - old_pure, old_plat = _distutils.get_isolated_environment_lib_paths(prefix) |
493 |
| - old_lib_paths = _deduplicated(old_pure, old_plat) |
494 |
| - |
495 |
| - # Apple's Python (shipped with Xcode and Command Line Tools) hard-code |
496 |
| - # platlib and purelib to '/Library/Python/X.Y/site-packages'. This will |
497 |
| - # cause serious build isolation bugs when Apple starts shipping 3.10 because |
498 |
| - # pip will install build backends to the wrong location. This tells users |
499 |
| - # who is at fault so Apple may notice it and fix the issue in time. |
500 |
| - if all(_looks_like_apple_library(p) for p in old_lib_paths): |
501 |
| - deprecated( |
502 |
| - reason=( |
503 |
| - "Python distributed by Apple's Command Line Tools incorrectly " |
504 |
| - "patches sysconfig to always point to '/Library/Python'. This " |
505 |
| - "will cause build isolation to operate incorrectly on Python " |
506 |
| - "3.10 or later. Please help report this to Apple so they can " |
507 |
| - "fix this. https://developer.apple.com/bug-reporting/" |
508 |
| - ), |
509 |
| - replacement=None, |
510 |
| - gone_in=None, |
511 |
| - ) |
512 |
| - return old_lib_paths |
513 |
| - |
514 |
| - warned = [ |
515 |
| - _warn_if_mismatch( |
516 |
| - pathlib.Path(old_pure), |
517 |
| - pathlib.Path(new_pure), |
518 |
| - key="prefixed-purelib", |
519 |
| - ), |
520 |
| - _warn_if_mismatch( |
521 |
| - pathlib.Path(old_plat), |
522 |
| - pathlib.Path(new_plat), |
523 |
| - key="prefixed-platlib", |
524 |
| - ), |
525 |
| - ] |
526 |
| - if any(warned): |
527 |
| - _log_context(prefix=prefix) |
528 |
| - |
529 |
| - return old_lib_paths |
530 |
| - |
531 |
| - |
532 |
| -def get_isolated_environment_bin_path(prefix: str) -> str: |
533 |
| - return _sysconfig.get_isolated_environment_paths(prefix)["scripts"] |
0 commit comments