MCPcopy
hub / github.com/pex-tool/pex / create_interpreter

Method create_interpreter

pex/interpreter.py:1101–1118  ·  view source on GitHub ↗
(
            stdout,  # type: bytes
            check_binary=False,  # type: bool
        )

Source from the content-addressed store, hash-verified

1099 # type: (...) -> SpawnedJob[PythonInterpreter]
1100
1101 def create_interpreter(
1102 stdout, # type: bytes
1103 check_binary=False, # type: bool
1104 ):
1105 # type: (...) -> PythonInterpreter
1106 identity = stdout.decode("utf-8").strip()
1107 if not identity:
1108 raise cls.IdentificationError("Could not establish identity of {}.".format(binary))
1109 interpreter = cls(PythonIdentity.decode(identity))
1110 # We should not need to check this since binary == interpreter.binary should always be
1111 # true, but historically this could be untrue as noted in `PythonIdentity.get`.
1112 if check_binary and not os.path.exists(interpreter.binary):
1113 raise cls.InterpreterNotFound(
1114 "Cached interpreter for {} reports a binary of {}, which could not be found".format(
1115 binary, interpreter.binary
1116 )
1117 )
1118 return interpreter
1119
1120 cache_dir = InterpreterDir.create(binary)
1121 if ignore_cached:

Callers

nothing calls this directly

Calls 2

stripMethod · 0.80
decodeMethod · 0.80

Tested by

no test coverage detected