This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
[wip] Improve ability to detect Python 2 during build #16885
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
Use @atom/dowsing-rod to aggressively detect python 2 installations and pass it to node-gyp subprocesses. We won't be able to get away from requiring python 2 entirely, but we can at least accept a python 2 path from
npm config get python
or${PYTHON}
.Without this in place, even with
${PYTHON}
set to a python2 install, the build for git-utils fails with a python 2/3 compatibility problem. It turns out that the Makefile generated by node-gyp sometimes executes a file with a#!/usr/bin/env python
shebang line, so unless the python2 binary is actually discoverable on the${PATH}
as "python", the build fails.Alternate Designs
The clearest alternative is to actually fix node-gyp at the source, by porting gyp to Python 3 or JavaScript. That would require getting a patch accepted into gyp, then waiting for it to be included in a node-gyp release, then a node release, then upgrade our build to use that node version.
Why Should This Be In Core?
It's where the build is.
I'm also going to create a parallel pull request for apm to improve our Python detection during apm builds (atom/apm#775).
Benefits
Developers who:
homebrew
on MacOS and have thepython
formula installed.python
package....will be able to build Atom without having to break things on their system that rely on Python 3 being the default. We'll also have a nice message if Python 2 cannot be found.
Possible Drawbacks
Verification Process
The ultimate test is to run
script/build
with Python 3 on the PATH.Applicable Issues