Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use the same python executable to run configure and gyp #39498

Closed
wants to merge 1 commit into from

Conversation

joyeecheung
Copy link
Member

Otherwise we would end up using python 2 to run actions in the gyp
config if that's the system default.

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. labels Jul 23, 2021
Otherwise we would end up using python 2 to run actions in the gyp
config if that's the system default.
@richardlau
Copy link
Member

Similar to #39465.

Otherwise we would end up using python 2 to run actions in the gyp
config if that's the system default.

This should not be the case if using make due to the symlinking that goes on in

node/configure.py

Lines 1857 to 1888 in 56a7e0a

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 3), 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
and path manipulation done in

node/configure.py

Lines 1992 to 1997 in 56a7e0a

# 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_str = 'export PATH:=' + bin_override + ':$(PATH)\n' + config_str
write('config.mk', do_not_edit + config_str)
.

@legendecas
Copy link
Member

hi, @joyeecheung, can you take a look at #39465?

@joyeecheung
Copy link
Member Author

closing in favor of #39465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants