Python2 regression with 1.15.3 #698
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
It seems like b364c3c introduced a regression for Arch-Linux users, as node-gyp tries to use python3 instead of python2 when beeing executed via apm.
This is the same issue as with #95, but due to the aforementioned commit the workarounds export PYTHON=python2
or npm config set python /usr/bin/python2 -g
do no work anymore.
Steps to Reproduce
Method 1
- Boot into an arch-linux system (eg. Manjaro LiveCD)
- Install atom-editor from AUR (Version 1.15.0 at the time of this writing)
- Install git-blame via apm (which uses node-gyp)
Method 2
- Temporary symlink
/usr/bin/python
to/usr/bin/python3
instead of/usr/bin/python2
. - Try (re-)installing git-blame via apm (which uses node-gyp)
Expected behavior: git-blame installs
Actual behavior: git blame fails with
$ apm install git-blame
Installing git-blame to /home/hufschmt/.atom/packages ✗
> [email protected] install /tmp/apm-install-dir-117214-7034-190qczt/node_modules/git-blame/node_modules/runas
> node-gyp rebuild
/tmp/apm-install-dir-117214-7034-190qczt
└── (empty)
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/usr/share/atom/resources/app/apm/bin/python-interceptor.sh" is v3.6.0, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack at failPythonVersion (/usr/share/atom/resources/app/apm/node_modules/node-gyp/lib/configure.js:454:14)
gyp ERR! stack at /usr/share/atom/resources/app/apm/node_modules/node-gyp/lib/configure.js:443:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:204:7)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at maybeClose (internal/child_process.js:827:16)
gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:319:11)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! stack at Socket.emit (events.js:169:7)
gyp ERR! stack at Pipe._onclose (net.js:477:12)
gyp ERR! System Linux 4.10.1-1-MANJARO
gyp ERR! command "/usr/share/atom/resources/app/apm/bin/node" "/usr/share/atom/resources/app/apm/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /tmp/apm-install-dir-117214-7034-190qczt/node_modules/git-blame/node_modules/runas
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
[...]
Reproduces how often: Always
Versions
$ apm --version
apm 1.15.3
npm 3.10.5
node 4.4.5 x64
python 3.6.0
git 2.12.0
$ atom --version
Atom : 1.15.0
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
OS: Manjaro (based on Arch-Linux)
Additional Information
Dirty workaround:
Uncomment export PYTHON="${binDir}/python-interceptor.sh"
in /usr/bin/apm
, this yields a working build-chain with:
$ apm --version
apm 1.15.3
npm 3.10.5
node 4.4.5 x64
python 2.7.13
git 2.12.0
Suggested fix
Make python-interceptor.sh
use the python-executable set via environment variable instead of hard-coding it to python
.
Or read the value from the --python
switch, such that the fix matches the one given by node-gyp. 😊