From 3482bca643ba4b5e486ebfd42a563993a014b2e4 Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 20 Jul 2021 18:00:19 +0800 Subject: [PATCH] build: override python executable path on configure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/39465 Fixes: https://github.com/nodejs/node/issues/39408 Fixes: https://github.com/nodejs/node/issues/39456 Reviewed-By: Zeyu Yang Reviewed-By: Tobias Nießen Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- Makefile | 2 +- configure.py | 4 ++++ node.gyp | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a339c3f96f6a2e..f346a4d61f8b2c 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ out/Makefile: config.gypi common.gypi node.gyp \ # and included in config.gypi config.gypi: configure configure.py src/node_version.h @if [ -x config.status ]; then \ - ./config.status; \ + export PATH="$(NO_BIN_OVERRIDE_PATH)" && ./config.status; \ else \ echo Missing or stale $@, please run ./$<; \ exit 1; \ diff --git a/configure.py b/configure.py index 14c75028668aad..30cf6726ae8916 100755 --- a/configure.py +++ b/configure.py @@ -1905,6 +1905,10 @@ def make_bin_override(): if options.compile_commands_json: gyp_args += ['-f', 'compile_commands_json'] +# override the variable `python` defined in common.gypi +if bin_override is not None: + gyp_args += ['-Dpython=' + sys.executable] + # pass the leftover positional arguments to GYP gyp_args += args diff --git a/node.gyp b/node.gyp index 3e47436a6ac862..63f60a924bb98a 100644 --- a/node.gyp +++ b/node.gyp @@ -745,7 +745,7 @@ 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], 'process_outputs_as_sources': 1, 'action': [ - 'python', + '<(python)', 'tools/mkssldef.py', '<@(mkssldef_flags)', '-o', @@ -771,7 +771,7 @@ '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', ], 'action': [ - 'python', + '<(python)', 'tools/js2c.py', '--directory', 'lib',