Canonicalize a potential Python interpreter path. This will return a path-equivalent of the given `path` in canonical form for use in cache keys. N.B.: If the path is a venv symlink it will not be fully de-referenced in order to maintain fidelity with the requested
(cls, path)
| 897 | |
| 898 | @classmethod |
| 899 | def canonicalize_path(cls, path): |
| 900 | # type: (str) -> str |
| 901 | """Canonicalize a potential Python interpreter path. |
| 902 | |
| 903 | This will return a path-equivalent of the given `path` in canonical form for use in cache |
| 904 | keys. |
| 905 | |
| 906 | N.B.: If the path is a venv symlink it will not be fully de-referenced in order to maintain |
| 907 | fidelity with the requested venv Python binary choice. |
| 908 | """ |
| 909 | # If the path is a PEP-405 venv interpreter symlink we do not want to resolve outside the |
| 910 | # venv in order to stay faithful to the binary path choice. |
| 911 | return cls._resolve_pyvenv_canonical_python_binary( |
| 912 | maybe_venv_python_binary=path |
| 913 | ) or os.path.realpath(path) |
| 914 | |
| 915 | class Error(Exception): |
| 916 | pass |
no test coverage detected