diff --git a/configure.py b/configure.py index 1dd6da6d2b997a..9cd664a05c2add 100755 --- a/configure.py +++ b/configure.py @@ -1523,40 +1523,6 @@ def configure_inspector(o): options.without_ssl) o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1 - -def make_bin_override(): - if sys.platform == 'win32': - raise Exception('make_bin_override should not be called on win32.') - # If the system python is not the python we are running (which should be - # python 2), then create a directory with a symlink called `python` to our - # sys.executable. This directory will be prefixed to the PATH, so that - # other tools that shell out to `python` will use the appropriate python - - which_python = which('python') - if (which_python and - os.path.realpath(which_python) == os.path.realpath(sys.executable)): - return - - bin_override = os.path.abspath('out/tools/bin') - try: - os.makedirs(bin_override) - except OSError as e: - if e.errno != errno.EEXIST: raise e - - python_link = os.path.join(bin_override, 'python') - try: - os.unlink(python_link) - except OSError as e: - if e.errno != errno.ENOENT: raise e - os.symlink(sys.executable, python_link) - - # We need to set the environment right now so that when gyp (in run_gyp) - # shells out, it finds the right python (specifically at - # https://github.com/nodejs/node/blob/d82e107/deps/v8/gypfiles/toolchain.gypi#L43) - os.environ['PATH'] = bin_override + ':' + os.environ['PATH'] - - return bin_override - output = { 'variables': {}, 'include_dirs': [], @@ -1638,14 +1604,11 @@ def make_bin_override(): config = '\n'.join(['='.join(item) for item in config.items()]) + '\n' -# On Windows there's no reason to search for a different python binary. -bin_override = None if sys.platform == 'win32' else make_bin_override() -if bin_override: - config = 'export PATH:=' + bin_override + ':$(PATH)\n' + config +os.environ['PYTHON_EXECUTABLE'] = sys.executable write('config.mk', do_not_edit + config) -gyp_args = ['--no-parallel', '-Dconfiguring_node=1'] +gyp_args = ['--no-parallel', '-Dconfiguring_node=1', "-DPYTHON_EXECUTABLE=%s" % sys.executable] if options.use_ninja: gyp_args += ['-f', 'ninja'] diff --git a/node.gyp b/node.gyp index 3cf47ffc255531..b7b1d61b7e1872 100644 --- a/node.gyp +++ b/node.gyp @@ -838,7 +838,7 @@ 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], 'process_outputs_as_sources': 1, 'action': [ - 'python', + '<(PYTHON_EXECUTABLE)', 'tools/mkssldef.py', '<@(mkssldef_flags)', '-o', @@ -873,7 +873,7 @@ }] ], 'action': [ - 'python', 'tools/js2c.py', + '<(PYTHON_EXECUTABLE)', 'tools/js2c.py', '<@(_outputs)', '<@(_inputs)', ], diff --git a/src/inspector/node_inspector.gypi b/src/inspector/node_inspector.gypi index 6ec85461dda0d7..4875481652edea 100644 --- a/src/inspector/node_inspector.gypi +++ b/src/inspector/node_inspector.gypi @@ -77,7 +77,7 @@ '<(SHARED_INTERMEDIATE_DIR)/src/node_protocol.json', ], 'action': [ - 'python', + '<(PYTHON_EXECUTABLE)', 'tools/inspector_protocol/convert_protocol_to_json.py', '<@(_inputs)', '<@(_outputs)', @@ -95,7 +95,7 @@ ], 'process_outputs_as_sources': 1, 'action': [ - 'python', + '<(PYTHON_EXECUTABLE)', 'tools/inspector_protocol/code_generator.py', '--jinja_dir', '<@(protocol_tool_path)', '--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/', @@ -113,7 +113,7 @@ '<(SHARED_INTERMEDIATE_DIR)/concatenated_protocol.json', ], 'action': [ - 'python', + '<(PYTHON_EXECUTABLE)', 'tools/inspector_protocol/concatenate_protocols.py', '<@(_inputs)', '<@(_outputs)', @@ -129,7 +129,7 @@ ], 'process_outputs_as_sources': 1, 'action': [ - 'python', + '<(PYTHON_EXECUTABLE)', 'tools/compress_json.py', '<@(_inputs)', '<@(_outputs)', diff --git a/tools/gyp/gyp_main.py b/tools/gyp/gyp_main.py index 25a6eba94aae7d..c541977d7b9cb4 100755 --- a/tools/gyp/gyp_main.py +++ b/tools/gyp/gyp_main.py @@ -10,6 +10,8 @@ # Make sure we're using the version of pylib in this repo, not one installed # elsewhere on the system. sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), 'pylib')) +sys.argv.append("-DPYTHON_EXECUTABLE=" + os.path.realpath(sys.executable)) +os.environ['PYTHON_EXECUTABLE'] = os.path.realpath(sys.executable) import gyp if __name__ == '__main__': diff --git a/tools/gyp/pylib/gyp/generator/xcode.py b/tools/gyp/pylib/gyp/generator/xcode.py index db99d6ab81ed5c..4563415dff7f95 100644 --- a/tools/gyp/pylib/gyp/generator/xcode.py +++ b/tools/gyp/pylib/gyp/generator/xcode.py @@ -284,10 +284,10 @@ def Finalize1(self, xcode_targets, serialize_all_tests): command_prefix = '' if serialize_all_tests: command_prefix = \ -"""python -c "import fcntl, subprocess, sys +"""%s -c "import fcntl, subprocess, sys file = open('$TMPDIR/GYP_serialize_test_runs', 'a') fcntl.flock(file.fileno(), fcntl.LOCK_EX) -sys.exit(subprocess.call(sys.argv[1:]))" """ +sys.exit(subprocess.call(sys.argv[1:]))" """ % (sys.executable) # If we were unable to exec for some reason, we want to exit # with an error, and fixup variable references to be shell diff --git a/tools/icu/icu-generic.gyp b/tools/icu/icu-generic.gyp index b8f0d13836dee1..2f71e308001f05 100644 --- a/tools/icu/icu-generic.gyp +++ b/tools/icu/icu-generic.gyp @@ -240,7 +240,7 @@ 'msvs_quote_cmd': 0, 'inputs': [ '<(icu_data_in)', 'icu_small.json' ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ], - 'action': [ 'python', + 'action': [ '<(PYTHON_EXECUTABLE)', 'icutrim.py', '-P', '<(PRODUCT_DIR)/.', # '.' suffix is a workaround against GYP assumptions :( '-D', '<(icu_data_in)', @@ -322,7 +322,7 @@ 'action_name': 'icutrim', 'inputs': [ '<(icu_data_in)', 'icu_small.json' ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ], - 'action': [ 'python', + 'action': [ '<(PYTHON_EXECUTABLE)', 'icutrim.py', '-P', '<(PRODUCT_DIR)', '-D', '<(icu_data_in)', diff --git a/tools/v8_gypfiles/broken/shim_headers.gypi b/tools/v8_gypfiles/broken/shim_headers.gypi index 940211c2401c43..a9c468057f81df 100644 --- a/tools/v8_gypfiles/broken/shim_headers.gypi +++ b/tools/v8_gypfiles/broken/shim_headers.gypi @@ -62,7 +62,7 @@ 'outputs': [ '