From 6bda88af83626a45e45289822c472a3f4200dca1 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Mon, 21 Jul 2025 00:30:35 +0200 Subject: [PATCH 1/2] gh-136852: Emscripten: Add PYTHON_NODE_VERSION environment variable (GH-136853) To choose the node version we use. Together with: https://github.com/python/buildmaster-config/pull/614 closes GH-136852. (cherry picked from commit aec7f5f8b2e8b5e02869cdb4e1f8a9ef87c9f953) Co-authored-by: Hood Chatham --- Tools/wasm/emscripten/__main__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tools/wasm/emscripten/__main__.py b/Tools/wasm/emscripten/__main__.py index c0d58aeaadd2cf..d22506d1337841 100644 --- a/Tools/wasm/emscripten/__main__.py +++ b/Tools/wasm/emscripten/__main__.py @@ -206,6 +206,17 @@ def configure_emscripten_python(context, working_dir): sysconfig_data += "-pydebug" host_runner = context.host_runner + if node_version := os.environ.get("PYTHON_NODE_VERSION", None): + res = subprocess.run( + [ + "bash", + "-c", + f"source ~/.nvm/nvm.sh && nvm which {node_version}", + ], + text=True, + capture_output=True, + ) + host_runner = res.stdout pkg_config_path_dir = (PREFIX_DIR / "lib/pkgconfig/").resolve() env_additions = { "CONFIG_SITE": config_site, From a3f9e0ea2577cae24801003c69ee2da9ca38bfb8 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Mon, 21 Jul 2025 11:17:36 +0200 Subject: [PATCH 2/2] gh-136852: Emscripten: Fix bug in #136853 (#136909) We need to get rid of some whitespace to make this work. --- Tools/wasm/emscripten/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/wasm/emscripten/__main__.py b/Tools/wasm/emscripten/__main__.py index d22506d1337841..1b31e36dd890b3 100644 --- a/Tools/wasm/emscripten/__main__.py +++ b/Tools/wasm/emscripten/__main__.py @@ -216,7 +216,7 @@ def configure_emscripten_python(context, working_dir): text=True, capture_output=True, ) - host_runner = res.stdout + host_runner = res.stdout.strip() pkg_config_path_dir = (PREFIX_DIR / "lib/pkgconfig/").resolve() env_additions = { "CONFIG_SITE": config_site,