[Python-checkins] gh-93939: Use new MODULE_name_STATE in wasm_assets script (GH-95035)

miss-islington webhook-mailer at python.org
Wed Jul 20 03:18:04 EDT 2022


https://github.com/python/cpython/commit/e98728ab4d4ab9e69ce05ae4da4031bbc80f457b
commit: e98728ab4d4ab9e69ce05ae4da4031bbc80f457b
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-07-20T00:17:52-07:00
summary:

gh-93939: Use new MODULE_name_STATE in wasm_assets script (GH-95035)

(cherry picked from commit 0f34c7e2d3163525813dbd644f30db58e6d36af2)

Co-authored-by: Christian Heimes <christian at python.org>

files:
M Tools/wasm/wasm_assets.py

diff --git a/Tools/wasm/wasm_assets.py b/Tools/wasm/wasm_assets.py
index b7e83517cae03..40acea2efaef2 100755
--- a/Tools/wasm/wasm_assets.py
+++ b/Tools/wasm/wasm_assets.py
@@ -175,14 +175,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



More information about the Python-checkins mailing list