Skip to content

Commit 5b5dca9

Browse files
silverwinditaloacasas
authored andcommitted
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: #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>
1 parent 60fc567 commit 5b5dca9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

configure

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
import sys
44
if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7):
5-
sys.stdout.write("Please use either Python 2.6 or 2.7\n")
5+
sys.stderr.write('Please use either Python 2.6 or 2.7')
6+
7+
from distutils.spawn import find_executable as which
8+
python2 = which('python2') or which('python2.6') or which('python2.7')
9+
10+
if python2:
11+
sys.stderr.write(':\n\n')
12+
sys.stderr.write(' ' + python2 + ' ' + ' '.join(sys.argv))
13+
14+
sys.stderr.write('\n')
615
sys.exit(1)
716

817
import errno

0 commit comments

Comments
 (0)