|
20 | 20 | assert (CHECKOUT / "configure").is_file(), "Please update the location of the file" |
21 | 21 |
|
22 | 22 | CROSS_BUILD_DIR = CHECKOUT / "cross-build" |
23 | | -BUILD_DIR = CROSS_BUILD_DIR / "build" |
| 23 | +# Build platform can also be found via `config.guess`. |
| 24 | +BUILD_DIR = CROSS_BUILD_DIR / sysconfig.get_config_var("BUILD_GNU_TYPE") |
24 | 25 |
|
25 | 26 | LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local" |
26 | 27 | LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/wasi.py\n".encode("utf-8") |
@@ -77,7 +78,7 @@ def wrapper(context): |
77 | 78 | print("📁", working_dir) |
78 | 79 | if (clean_ok and getattr(context, "clean", False) and |
79 | 80 | working_dir.exists()): |
80 | | - print(f"🚮 Deleting directory (--clean)...") |
| 81 | + print("🚮 Deleting directory (--clean)...") |
81 | 82 | shutil.rmtree(working_dir) |
82 | 83 |
|
83 | 84 | working_dir.mkdir(parents=True, exist_ok=True) |
@@ -110,12 +111,6 @@ def call(command, *, quiet, **kwargs): |
110 | 111 | subprocess.check_call(command, **kwargs, stdout=stdout, stderr=stderr) |
111 | 112 |
|
112 | 113 |
|
113 | | -def build_platform(): |
114 | | - """The name of the build/host platform.""" |
115 | | - # Can also be found via `config.guess`. |
116 | | - return sysconfig.get_config_var("BUILD_GNU_TYPE") |
117 | | - |
118 | | - |
119 | 114 | def build_python_path(): |
120 | 115 | """The path to the build Python binary.""" |
121 | 116 | binary = BUILD_DIR / "python" |
@@ -249,7 +244,7 @@ def configure_wasi_python(context, working_dir): |
249 | 244 | # executed from within a checkout. |
250 | 245 | configure = [os.path.relpath(CHECKOUT / 'configure', working_dir), |
251 | 246 | f"--host={context.host_triple}", |
252 | | - f"--build={build_platform()}", |
| 247 | + f"--build={BUILD_DIR.name}", |
253 | 248 | f"--with-build-python={build_python}"] |
254 | 249 | if build_python_is_pydebug(): |
255 | 250 | configure.append("--with-pydebug") |
@@ -330,8 +325,8 @@ def main(): |
330 | 325 | "Python)") |
331 | 326 | make_host = subcommands.add_parser("make-host", |
332 | 327 | help="Run `make` for the host/WASI") |
333 | | - clean = subcommands.add_parser("clean", help="Delete files and directories " |
334 | | - "created by this script") |
| 328 | + subcommands.add_parser("clean", help="Delete files and directories " |
| 329 | + "created by this script") |
335 | 330 | for subcommand in build, configure_build, make_build, configure_host, make_host: |
336 | 331 | subcommand.add_argument("--quiet", action="store_true", default=False, |
337 | 332 | dest="quiet", |
|
0 commit comments