From 8f49962f47b967a1b30dccf9fff2b7b8cc17aace Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Wed, 15 Feb 2017 12:30:40 +0100 Subject: [PATCH] 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 Reviewed-By: Jeremiah Senkpiel Reviewed-By: Colin Ihrig Reviewed-By: Gibson Fahnestock --- configure | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index be38ff770eb315..23c28f6bb84847 100755 --- a/configure +++ b/configure @@ -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