]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-93939: Use new MODULE_name_STATE in wasm_assets script (GH-95035)
authorChristian Heimes <christian@python.org>
Wed, 20 Jul 2022 06:53:26 +0000 (08:53 +0200)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 06:53:26 +0000 (08:53 +0200)
Tools/wasm/wasm_assets.py

index a59db9db7cdd2083489c371a211d3b9cfeb42c5d..07450ac928dcd6f9178602f3df5b6cc5a2a5a1e1 100755 (executable)
@@ -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