|
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 .\n" |
@@ -80,7 +81,7 @@ def wrapper(context): |
80 | 81 | print("📁", working_dir) |
81 | 82 | if (clean_ok and getattr(context, "clean", False) and |
82 | 83 | working_dir.exists()): |
83 | | - print(f"🚮 Deleting directory (--clean)...") |
| 84 | + print("🚮 Deleting directory (--clean)...") |
84 | 85 | shutil.rmtree(working_dir) |
85 | 86 |
|
86 | 87 | working_dir.mkdir(parents=True, exist_ok=True) |
@@ -120,12 +121,6 @@ def call(command, *, context=None, quiet=False, logdir=None, **kwargs): |
120 | 121 | subprocess.check_call(command, **kwargs, stdout=stdout, stderr=stderr) |
121 | 122 |
|
122 | 123 |
|
123 | | -def build_platform(): |
124 | | - """The name of the build/host platform.""" |
125 | | - # Can also be found via `config.guess`. |
126 | | - return sysconfig.get_config_var("BUILD_GNU_TYPE") |
127 | | - |
128 | | - |
129 | 124 | def build_python_path(): |
130 | 125 | """The path to the build Python binary.""" |
131 | 126 | binary = BUILD_DIR / "python" |
@@ -274,7 +269,7 @@ def configure_wasi_python(context, working_dir): |
274 | 269 | # executed from within a checkout. |
275 | 270 | configure = [os.path.relpath(CHECKOUT / 'configure', working_dir), |
276 | 271 | f"--host={context.host_triple}", |
277 | | - f"--build={build_platform()}", |
| 272 | + f"--build={BUILD_DIR.name}", |
278 | 273 | f"--with-build-python={build_python}"] |
279 | 274 | if build_python_is_pydebug(): |
280 | 275 | configure.append("--with-pydebug") |
@@ -357,8 +352,8 @@ def main(): |
357 | 352 | "Python)") |
358 | 353 | make_host = subcommands.add_parser("make-host", |
359 | 354 | help="Run `make` for the host/WASI") |
360 | | - clean = subcommands.add_parser("clean", help="Delete files and directories " |
361 | | - "created by this script") |
| 355 | + subcommands.add_parser("clean", help="Delete files and directories " |
| 356 | + "created by this script") |
362 | 357 | for subcommand in build, configure_build, make_build, configure_host, make_host: |
363 | 358 | subcommand.add_argument("--quiet", action="store_true", default=False, |
364 | 359 | dest="quiet", |
|
0 commit comments