MCPcopy
hub / github.com/astral-sh/python-build-standalone / run_dist_python

Function run_dist_python

pythonbuild/testdist.py:16–43  ·  view source on GitHub ↗

Runs a `python` process from an extracted PBS distribution. This function attempts to isolate the spawned interpreter from any external interference (PYTHON* environment variables), etc.

(
    dist_root: Path,
    python_info,
    args: list[str],
    extra_env: Optional[dict[str, str]] = None,
    **runargs,
)

Source from the content-addressed store, hash-verified

14
15
16def run_dist_python(
17 dist_root: Path,
18 python_info,
19 args: list[str],
20 extra_env: Optional[dict[str, str]] = None,
21 **runargs,
22) -> subprocess.CompletedProcess[str]:
23 """Runs a `python` process from an extracted PBS distribution.
24
25 This function attempts to isolate the spawned interpreter from any
26 external interference (PYTHON* environment variables), etc.
27 """
28 env = dict(os.environ)
29
30 # Wipe PYTHON environment variables.
31 for k in list(env):
32 if k.startswith("PYTHON"):
33 del env[k]
34
35 if extra_env:
36 env.update(extra_env)
37
38 return subprocess.run(
39 [str(dist_root / python_info["python_exe"])] + args,
40 cwd=dist_root,
41 env=env,
42 **runargs,
43 )
44
45
46def run_custom_unittests(pbs_source_dir: Path, dist_root: Path, python_info) -> int:

Callers 2

run_custom_unittestsFunction · 0.85
run_stdlib_testsFunction · 0.85

Calls 2

updateMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected