Skip to content

Commit

Permalink
pythongh-93939: Use new MODULE_name_STATE in wasm_assets script
Browse files Browse the repository at this point in the history
``wasm_assets.py`` was using the old ``MODULE_name`` variable to detect
if a shared extension is available. Emscripten browser builds now
correctly detect that e.g. ``json`` module is available.
  • Loading branch information
tiran committed Jul 20, 2022
1 parent 74b5e4c commit 346999e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Tools/wasm/wasm_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,13 @@ def detect_extension_modules(args: argparse.Namespace):
loc = {}
exec(data, globals(), loc)

for name, value in loc["build_time_vars"].items():
if value not in {"yes", "missing", "disabled", "n/a"}:
for key, value in loc["build_time_vars"].items():
if not key.startswith("MODULE_") or not key.endswith("_STATE"):
continue
if not name.startswith("MODULE_"):
continue
if name.endswith(("_CFLAGS", "_DEPS", "_LDFLAGS")):
continue
modname = name.removeprefix("MODULE_").lower()
if value not in {"yes", "disabled", "missing", "n/a"}:
raise ValueError(f"Unsupported value '{value}' for {key}")

modname = key[7:-6].lower()
if modname not in modules:
modules[modname] = value == "yes"
return modules
Expand Down

0 comments on commit 346999e

Please sign in to comment.