Skip to content

Commit b142878

Browse files
authored
Improve error messages when the WASI SDK can't be found (GH-149508)
1 parent f0daba1 commit b142878

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Platforms/WASI/_build.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,8 @@ def wasi_sdk(context):
222222
if wasi_sdk_path := context.wasi_sdk_path:
223223
if not wasi_sdk_path.exists():
224224
raise ValueError(
225-
"WASI SDK not found; "
226-
"download from "
227-
"https://github.com/WebAssembly/wasi-sdk and/or "
228-
"specify via $WASI_SDK_PATH or --wasi-sdk"
225+
"WASI SDK not found at "
226+
f"{os.fsdecode(wasi_sdk_path)!r} (via --wasi-sdk)"
229227
)
230228
return wasi_sdk_path
231229

@@ -237,7 +235,8 @@ def wasi_sdk(context):
237235
wasi_sdk_path = pathlib.Path(wasi_sdk_path_env_var)
238236
if not wasi_sdk_path.exists():
239237
raise ValueError(
240-
f"WASI SDK not found at $WASI_SDK_PATH ({wasi_sdk_path})"
238+
f"WASI SDK not found at {os.fsdecode(wasi_sdk_path)!r} "
239+
"(via $WASI_SDK_PATH)"
241240
)
242241
else:
243242
opt_path = pathlib.Path("/opt")
@@ -272,6 +271,14 @@ def wasi_sdk(context):
272271
f" Found WASI SDK {major_version}, "
273272
f"but WASI SDK {wasi_sdk_version} is the supported version",
274273
)
274+
elif not wasi_sdk_path:
275+
raise ValueError(
276+
f"WASI SDK {wasi_sdk_version} not found; "
277+
"download from "
278+
"https://github.com/WebAssembly/wasi-sdk and install in "
279+
f"{os.fsdecode(opt_path)!r} or specify the SDK via "
280+
"$WASI_SDK_PATH or --wasi-sdk"
281+
)
275282

276283
# Cache the result.
277284
context.wasi_sdk_path = wasi_sdk_path

0 commit comments

Comments
 (0)