From 8f44e7863654700d5f99d70a79146ae640e9e57f Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Wed, 23 Jul 2025 10:42:08 -0700 Subject: [PATCH] Touch up `Setup.local` handling in `Tools/wasm/wasi` The comment in the generated file is more self-explanatory. The checks for unexpected file contents are also strengthened. --- Tools/wasm/wasi/__main__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Tools/wasm/wasi/__main__.py b/Tools/wasm/wasi/__main__.py index 54ccc95157d57d..f3c97ff3fd11a0 100644 --- a/Tools/wasm/wasi/__main__.py +++ b/Tools/wasm/wasi/__main__.py @@ -23,7 +23,8 @@ BUILD_DIR = CROSS_BUILD_DIR / "build" LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local" -LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/wasi.py\n".encode("utf-8") +LOCAL_SETUP_MARKER = ("# Generated by Tools/wasm/wasi .\n" + "# Required to statically build extension modules.").encode("utf-8") WASMTIME_VAR_NAME = "WASMTIME" WASMTIME_HOST_RUNNER_VAR = f"{{{WASMTIME_VAR_NAME}}}" @@ -141,9 +142,12 @@ def build_python_is_pydebug(): def configure_build_python(context, working_dir): """Configure the build/host Python.""" if LOCAL_SETUP.exists(): - print(f"๐Ÿ‘ {LOCAL_SETUP} exists ...") + if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER: + print(f"๐Ÿ‘ {LOCAL_SETUP} exists ...") + else: + print(f"โš ๏ธ {LOCAL_SETUP} exists, but has unexpected contents") else: - print(f"๐Ÿ“ Touching {LOCAL_SETUP} ...") + print(f"๐Ÿ“ Creating {LOCAL_SETUP} ...") LOCAL_SETUP.write_bytes(LOCAL_SETUP_MARKER) configure = [os.path.relpath(CHECKOUT / 'configure', working_dir)] @@ -297,9 +301,8 @@ def clean_contents(context): shutil.rmtree(CROSS_BUILD_DIR) if LOCAL_SETUP.exists(): - with LOCAL_SETUP.open("rb") as file: - if file.read(len(LOCAL_SETUP_MARKER)) == LOCAL_SETUP_MARKER: - print(f"๐Ÿงน Deleting generated {LOCAL_SETUP} ...") + if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER: + print(f"๐Ÿงน Deleting generated {LOCAL_SETUP} ...") def main(): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy