MCPcopy Index your code
hub / github.com/astral-sh/python-build-standalone / add_env_common

Function add_env_common

pythonbuild/utils.py:573–596  ·  view source on GitHub ↗

Adds extra keys to environment variables.

(env)

Source from the content-addressed store, hash-verified

571
572
573def add_env_common(env):
574 """Adds extra keys to environment variables."""
575
576 cpu_count = multiprocessing.cpu_count()
577 env["NUM_CPUS"] = "%d" % cpu_count
578 env["NUM_JOBS_AGGRESSIVE"] = "%d" % max(cpu_count + 2, cpu_count * 2)
579
580 if "CI" in os.environ:
581 env["CI"] = "1"
582
583 env_path = os.path.expanduser("~/.python-build-standalone-env")
584 try:
585 with open(env_path) as fh:
586 for line in fh:
587 line = line.strip()
588 if line.startswith("#"):
589 continue
590
591 key, value = line.split("=", 1)
592
593 print("adding %s from %s" % (key, env_path))
594 env[key] = value
595 except FileNotFoundError:
596 pass
597
598
599def exec_and_log(args, cwd, env):

Callers 2

add_target_envFunction · 0.90
build_binutilsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected