https://github.com/python/cpython/commit/b311ea869141acff7985ba3b7ae304ec04e39229
commit: b311ea869141acff7985ba3b7ae304ec04e39229
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: zware <[email protected]>
date: 2026-05-07T22:27:34Z
summary:

[3.15] Improve error messages when the WASI SDK can't be found (GH-149519)

(cherry picked from commit b142878db1e54149feba62b08df1236432793bf0)

Co-authored-by: Brett Cannon <[email protected]>

files:
M Platforms/WASI/_build.py

diff --git a/Platforms/WASI/_build.py b/Platforms/WASI/_build.py
index 76d2853163baa9..c1a91a9c833b8e 100644
--- a/Platforms/WASI/_build.py
+++ b/Platforms/WASI/_build.py
@@ -222,10 +222,8 @@ def wasi_sdk(context):
     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"
+                "WASI SDK not found at "
+                f"{os.fsdecode(wasi_sdk_path)!r} (via --wasi-sdk)"
             )
         return wasi_sdk_path
 
@@ -237,7 +235,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 +271,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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to