Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more praces to replace python executeables
  • Loading branch information
dothebart committed Apr 29, 2019
commit 06bec9c202751925f6a0f3abe89e0cd006470bbd
43 changes: 4 additions & 39 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [],
Expand Down Expand Up @@ -1638,14 +1604,13 @@ 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

sys.argv.append("-DPYTHON_EXECUTABLE=" + sys.executable)
os.environ['PYTHON_EXECUTABLE'] = sys.executable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is not used in the context of this PR.


write('config.mk', do_not_edit + config)

gyp_args = ['--no-parallel', '-Dconfiguring_node=1']
gyp_args = ['--no-parallel', '-Dconfiguring_node=1', "-DPYTHON_EXECUTABLE=" + os.path.realpath(sys.executable)]
Comment thread
dothebart marked this conversation as resolved.
Outdated

if options.use_ninja:
gyp_args += ['-f', 'ninja']
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/gyp_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +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=" + sys.executable)
os.environ['PYTHON_EXECUTABLE'] = sys.executableimport gyp
sys.argv.append("-DPYTHON_EXECUTABLE=" + os.path.realpath(sys.executable))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be upstreamed to https://github.com/refack/GYP

In the context of this PR it's not necessary as there are should no be any direct calls to GYP outside of through ./configure

os.environ['PYTHON_EXECUTABLE'] = os.path.realpath(sys.executable)
import gyp

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tools/v8_gypfiles/toolchain.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
'has_valgrind%': 0,
'coverage%': 0,
'v8_target_arch%': '<(target_arch)',
'v8_host_byteorder%': '<!(python -c "import sys; print(sys.byteorder)")',
'v8_host_byteorder%': '<!<(PYTHON_EXECUTABLE) -c "import sys; print sys.byteorder")',
'force_dynamic_crt%': 0,

# Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
Expand Down