Debian Codegraph @

cross-project-tests/dtlto/local_codegen_and_wait.py

raw
1 """
2 This simple distributor performs code generation locally, creates the
3 "send-signal1" file, and then waits for the "send-signal2" file to appear
4 before exiting. It is intended to be used in tandem with test_temps.py.
5 Please see test_temps.py for more information.
6 """
7
8 import json, subprocess, sys, time, os, pathlib
9
10 # Load the DTLTO information from the input JSON file.
11 data = json.loads(pathlib.Path(sys.argv[-1]).read_bytes())
12
13 # Iterate over the jobs and execute the codegen tool.
14 for job in data["jobs"]:
15 subprocess.check_call(data["common"]["args"] + job["args"])
16
17 pathlib.Path("send-signal1").touch()
18
19 while not os.path.exists("send-signal2"):
20 time.sleep(0.05)