|
6 | 6 | # the error message that the version of Python is too old. |
7 | 7 |
|
8 | 8 |
|
9 | | -import argparse |
10 | 9 | from pathlib import Path |
11 | 10 | import shutil |
12 | 11 | import subprocess |
@@ -54,102 +53,21 @@ def install_requirements(venv: Path) -> None: |
54 | 53 | run_in_venv(venv, "pip", ["install", "-r", "requirements.txt"]) |
55 | 54 |
|
56 | 55 |
|
57 | | -def _main( |
58 | | - fork: str, |
59 | | - ref: str, |
60 | | - machine: str, |
61 | | - benchmarks: str, |
62 | | - flags: str, |
63 | | - force: bool, |
64 | | - pgo: bool, |
65 | | - perf: bool, |
66 | | - pystats: bool, |
67 | | - force_32bit: bool, |
68 | | - run_id: str | None = None, |
69 | | -): |
70 | | - if force_32bit and sys.platform != "win32": |
71 | | - raise RuntimeError("32-bit builds are only supported on Windows") |
72 | | - if perf and not sys.platform.startswith("linux"): |
73 | | - raise RuntimeError("perf profiling is only supported on Linux") |
74 | | - if pystats and not sys.platform.startswith("linux"): |
75 | | - raise RuntimeError("Pystats is only supported on Linux") |
76 | | - |
| 56 | +def main(): |
77 | 57 | venv = Path("venv") |
78 | 58 | create_venv(venv) |
79 | 59 | install_requirements(venv) |
80 | 60 |
|
81 | 61 | # Now that we've installed the full bench_runner library, |
82 | 62 | # continue on in a new process... |
83 | 63 |
|
84 | | - args = ["workflow", fork, ref, machine, benchmarks, flags] |
85 | | - if force: |
86 | | - args.append("--force") |
87 | | - if pgo: |
88 | | - args.append("--pgo") |
89 | | - if perf: |
90 | | - args.append("--perf") |
91 | | - if pystats: |
92 | | - args.append("--pystats") |
93 | | - if force_32bit: |
94 | | - args.append("--32bit") |
95 | | - if run_id: |
96 | | - args.extend(["--run_id", run_id]) |
97 | | - |
98 | | - run_in_venv(venv, "bench_runner", args) |
99 | | - |
| 64 | + last_arg = sys.argv.find("workflow_bootstrap.py") |
| 65 | + if last_arg == -1: |
| 66 | + raise ValueError( |
| 67 | + "The script should be run from the command line with the workflow_bootstrap.py argument" |
| 68 | + ) |
100 | 69 |
|
101 | | -def main(): |
102 | | - parser = argparse.ArgumentParser( |
103 | | - description=""" |
104 | | - Run the full compile/benchmark workflow. |
105 | | - """, |
106 | | - ) |
107 | | - parser.add_argument("fork", help="The fork of CPython") |
108 | | - parser.add_argument("ref", help="The git ref in the fork") |
109 | | - parser.add_argument( |
110 | | - "machine", |
111 | | - help="The machine to run the benchmarks on.", |
112 | | - ) |
113 | | - parser.add_argument("benchmarks", help="The benchmarks to run") |
114 | | - parser.add_argument("flags", help="Configuration flags") |
115 | | - parser.add_argument("--force", action="store_true", help="Force a re-run") |
116 | | - parser.add_argument( |
117 | | - "--pgo", |
118 | | - action="store_true", |
119 | | - help="Build with profiling guided optimization", |
120 | | - ) |
121 | | - parser.add_argument( |
122 | | - "--perf", |
123 | | - action="store_true", |
124 | | - help="Collect Linux perf profiling data (Linux only)", |
125 | | - ) |
126 | | - parser.add_argument( |
127 | | - "--pystats", |
128 | | - action="store_true", |
129 | | - help="Enable Pystats (Linux only)", |
130 | | - ) |
131 | | - parser.add_argument( |
132 | | - "--32bit", |
133 | | - action="store_true", |
134 | | - dest="force_32bit", |
135 | | - help="Do a 32-bit build (Windows only)", |
136 | | - ) |
137 | | - parser.add_argument("--run_id", default=None, type=str, help="The github run id") |
138 | | - args = parser.parse_args() |
139 | | - |
140 | | - _main( |
141 | | - args.fork, |
142 | | - args.ref, |
143 | | - args.machine, |
144 | | - args.benchmarks, |
145 | | - args.flags, |
146 | | - args.force, |
147 | | - args.pgo, |
148 | | - args.perf, |
149 | | - args.pystats, |
150 | | - args.force_32bit, |
151 | | - args.run_id, |
152 | | - ) |
| 70 | + run_in_venv(venv, "bench_runner", ["workflow", *sys.argv[last_arg + 1 :]]) |
153 | 71 |
|
154 | 72 |
|
155 | 73 | if __name__ == "__main__": |
|
0 commit comments