MCPcopy Index your code
hub / github.com/python/cpython / _run

Function _run

Tools/jit/_llvm.py:40–64  ·  view source on GitHub ↗
(tool: str, args: typing.Iterable[str], echo: bool = False)

Source from the content-addressed store, hash-verified

38
39
40async def _run(tool: str, args: typing.Iterable[str], echo: bool = False) -> str | None:
41 command = [tool, *args]
42 async with _CORES:
43 if echo:
44 print(shlex.join(command))
45
46 if os.name == "nt":
47 # When building with /p:PlatformToolset=ClangCL, the VS build
48 # system puts that clang's include path into INCLUDE. The JIT's
49 # clang may be a different version, and mismatched headers cause
50 # build errors. See https://github.com/python/cpython/issues/146210.
51 env = os.environ.copy()
52 env.pop("INCLUDE", None)
53 else:
54 env = None
55 try:
56 process = await asyncio.create_subprocess_exec(
57 *command, stdout=subprocess.PIPE, env=env
58 )
59 except FileNotFoundError:
60 return None
61 out, _ = await process.communicate()
62 if process.returncode:
63 raise RuntimeError(f"{tool} exited with return code {process.returncode}")
64 return out.decode()
65
66
67@_async_cache

Callers 3

_check_tool_versionFunction · 0.85
_get_brew_llvm_prefixFunction · 0.85
maybe_runFunction · 0.85

Calls 5

joinMethod · 0.45
copyMethod · 0.45
popMethod · 0.45
communicateMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…