MCPcopy Index your code
hub / github.com/pex-tool/pex / canonicalize_path

Method canonicalize_path

pex/interpreter.py:899–913  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 4

__init__Method · 0.95
_spawn_from_binaryMethod · 0.80
create_messageMethod · 0.80
normalize_pathFunction · 0.80

Tested by

no test coverage detected