From 4240f4b2f690b72257972d32af94685ee26fac30 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 7 May 2026 11:21:46 -0700 Subject: [PATCH 1/2] Improve error messages when the WASI SDK can't be found --- Platforms/WASI/_build.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Platforms/WASI/_build.py b/Platforms/WASI/_build.py index 76d2853163baa9..5a1136786c6321 100644 --- a/Platforms/WASI/_build.py +++ b/Platforms/WASI/_build.py @@ -221,12 +221,8 @@ def wasi_sdk(context): """Find the path to the WASI SDK.""" if wasi_sdk_path := context.wasi_sdk_path: if not wasi_sdk_path.exists(): - raise ValueError( - "WASI SDK not found; " - "download from " - "https://github.com/WebAssembly/wasi-sdk and/or " - "specify via $WASI_SDK_PATH or --wasi-sdk" - ) + raise ValueError("WASI SDK not found at " + f"{os.fsdecode(wasi_sdk_path)!r} (via --wasi-sdk)") return wasi_sdk_path with (HERE / "config.toml").open("rb") as file: @@ -237,7 +233,8 @@ def wasi_sdk(context): wasi_sdk_path = pathlib.Path(wasi_sdk_path_env_var) if not wasi_sdk_path.exists(): raise ValueError( - f"WASI SDK not found at $WASI_SDK_PATH ({wasi_sdk_path})" + f"WASI SDK not found at {os.fsdecode(wasi_sdk_path)!r} " + "(via $WASI_SDK_PATH)" ) else: opt_path = pathlib.Path("/opt") @@ -272,6 +269,14 @@ def wasi_sdk(context): f" Found WASI SDK {major_version}, " f"but WASI SDK {wasi_sdk_version} is the supported version", ) + elif not wasi_sdk_path: + raise ValueError( + f"WASI SDK {wasi_sdk_version} not found; " + "download from " + "https://github.com/WebAssembly/wasi-sdk and install in " + f"{os.fsdecode(opt_path)!r} or specify the SDK via " + "$WASI_SDK_PATH or --wasi-sdk" + ) # Cache the result. context.wasi_sdk_path = wasi_sdk_path From e5b361b910557d3e2945e744005d439369254f4f Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 7 May 2026 11:24:45 -0700 Subject: [PATCH 2/2] Fix formatting --- Platforms/WASI/_build.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Platforms/WASI/_build.py b/Platforms/WASI/_build.py index 5a1136786c6321..c1a91a9c833b8e 100644 --- a/Platforms/WASI/_build.py +++ b/Platforms/WASI/_build.py @@ -221,8 +221,10 @@ def wasi_sdk(context): """Find the path to the WASI SDK.""" if wasi_sdk_path := context.wasi_sdk_path: if not wasi_sdk_path.exists(): - raise ValueError("WASI SDK not found at " - f"{os.fsdecode(wasi_sdk_path)!r} (via --wasi-sdk)") + raise ValueError( + "WASI SDK not found at " + f"{os.fsdecode(wasi_sdk_path)!r} (via --wasi-sdk)" + ) return wasi_sdk_path with (HERE / "config.toml").open("rb") as file: @@ -271,12 +273,12 @@ def wasi_sdk(context): ) elif not wasi_sdk_path: raise ValueError( - f"WASI SDK {wasi_sdk_version} not found; " - "download from " - "https://github.com/WebAssembly/wasi-sdk and install in " - f"{os.fsdecode(opt_path)!r} or specify the SDK via " - "$WASI_SDK_PATH or --wasi-sdk" - ) + f"WASI SDK {wasi_sdk_version} not found; " + "download from " + "https://github.com/WebAssembly/wasi-sdk and install in " + f"{os.fsdecode(opt_path)!r} or specify the SDK via " + "$WASI_SDK_PATH or --wasi-sdk" + ) # Cache the result. context.wasi_sdk_path = wasi_sdk_path