Skip to content

[3.14] GH-137484: Have Tools/wasm/wasi use the build triple instead of "build" (GH-37485) #137487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.14
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Have ``Tools/wasm/wasi`` put the build Python into a directory named after
the build triple instead of "build".
17 changes: 6 additions & 11 deletions Tools/wasm/wasi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
assert (CHECKOUT / "configure").is_file(), "Please update the location of the file"

CROSS_BUILD_DIR = CHECKOUT / "cross-build"
BUILD_DIR = CROSS_BUILD_DIR / "build"
# Build platform can also be found via `config.guess`.
BUILD_DIR = CROSS_BUILD_DIR / sysconfig.get_config_var("BUILD_GNU_TYPE")

LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/wasi.py\n".encode("utf-8")
Expand Down Expand Up @@ -77,7 +78,7 @@ def wrapper(context):
print("📁", working_dir)
if (clean_ok and getattr(context, "clean", False) and
working_dir.exists()):
print(f"🚮 Deleting directory (--clean)...")
print("🚮 Deleting directory (--clean)...")
shutil.rmtree(working_dir)

working_dir.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -110,12 +111,6 @@ def call(command, *, quiet, **kwargs):
subprocess.check_call(command, **kwargs, stdout=stdout, stderr=stderr)


def build_platform():
"""The name of the build/host platform."""
# Can also be found via `config.guess`.
return sysconfig.get_config_var("BUILD_GNU_TYPE")


def build_python_path():
"""The path to the build Python binary."""
binary = BUILD_DIR / "python"
Expand Down Expand Up @@ -249,7 +244,7 @@ def configure_wasi_python(context, working_dir):
# executed from within a checkout.
configure = [os.path.relpath(CHECKOUT / 'configure', working_dir),
f"--host={context.host_triple}",
f"--build={build_platform()}",
f"--build={BUILD_DIR.name}",
f"--with-build-python={build_python}"]
if build_python_is_pydebug():
configure.append("--with-pydebug")
Expand Down Expand Up @@ -330,8 +325,8 @@ def main():
"Python)")
make_host = subcommands.add_parser("make-host",
help="Run `make` for the host/WASI")
clean = subcommands.add_parser("clean", help="Delete files and directories "
"created by this script")
subcommands.add_parser("clean", help="Delete files and directories "
"created by this script")
for subcommand in build, configure_build, make_build, configure_host, make_host:
subcommand.add_argument("--quiet", action="store_true", default=False,
dest="quiet",
Expand Down
Loading