Adds extra keys to environment variables.
(env)
| 571 | |
| 572 | |
| 573 | def 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 | |
| 599 | def exec_and_log(args, cwd, env): |
no outgoing calls
no test coverage detected