summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-07-20 06:53:26 (GMT)
committerGitHub <noreply@github.com>2022-07-20 06:53:26 (GMT)
commit0f34c7e2d3163525813dbd644f30db58e6d36af2 (patch)
treeb3fcd0e1ccbf28a8d42a02dd3225acf2c5e50c8f
parent1834133e66d95a143c9df5f068b3109927aefd65 (diff)
downloadcpython-0f34c7e2d3163525813dbd644f30db58e6d36af2.zip
cpython-0f34c7e2d3163525813dbd644f30db58e6d36af2.tar.gz
cpython-0f34c7e2d3163525813dbd644f30db58e6d36af2.tar.bz2
gh-93939: Use new MODULE_name_STATE in wasm_assets script (GH-95035)
-rwxr-xr-xTools/wasm/wasm_assets.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Tools/wasm/wasm_assets.py b/Tools/wasm/wasm_assets.py
index a59db9d..07450ac 100755
--- a/Tools/wasm/wasm_assets.py
+++ b/Tools/wasm/wasm_assets.py
@@ -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