Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Improve error messages when the WASI SDK can't be found
  • Loading branch information
brettcannon committed May 7, 2026
commit 4240f4b2f690b72257972d32af94685ee26fac30
19 changes: 12 additions & 7 deletions Platforms/WASI/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down
Loading