tools: suggest python2 command in configure

Try and find a suitable python2 binary and suggest it to the user in
case they start the configure script with a incompatible version.

PR-URL: https://github.com/nodejs/node/pull/11375
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
pull/11134/merge
Roman Reiss 2017-02-15 12:30:40 +01:00
parent f9dc722eb5
commit 25e803ebd0
No known key found for this signature in database
GPG Key ID: 2E62B41C93869443
1 changed files with 10 additions and 1 deletions

11
configure vendored
View File

@ -2,7 +2,16 @@
import sys
if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7):
sys.stdout.write("Please use either Python 2.6 or 2.7\n")
sys.stderr.write('Please use either Python 2.6 or 2.7')
from distutils.spawn import find_executable as which
python2 = which('python2') or which('python2.6') or which('python2.7')
if python2:
sys.stderr.write(':\n\n')
sys.stderr.write(' ' + python2 + ' ' + ' '.join(sys.argv))
sys.stderr.write('\n')
sys.exit(1)
import errno