diff options
Diffstat (limited to 'node_modules/node-gyp/lib/find-python.js')
-rw-r--r-- | node_modules/node-gyp/lib/find-python.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/node_modules/node-gyp/lib/find-python.js b/node_modules/node-gyp/lib/find-python.js index 1a4390dbd..e79bc50d5 100644 --- a/node_modules/node-gyp/lib/find-python.js +++ b/node_modules/node-gyp/lib/find-python.js @@ -16,10 +16,9 @@ function PythonFinder (configPython, callback) { PythonFinder.prototype = { log: logWithPrefix(log, 'find Python'), - argsExecutable: [ '-c', 'import sys; print(sys.executable);' ], - argsVersion: [ '-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);' ], - semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0' - : '>=2.6.0 <3.0.0', + argsExecutable: ['-c', 'import sys; print(sys.executable);'], + argsVersion: ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);'], + semverRange: '^2.6.0 || >=3.5.0', // These can be overridden for testing: execFile: cp.execFile, @@ -46,7 +45,7 @@ PythonFinder.prototype = { function getChecks () { if (this.env.NODE_GYP_FORCE_PYTHON) { - return [ { + return [{ before: () => { this.addLog( 'checking Python explicitly set from NODE_GYP_FORCE_PYTHON') @@ -55,7 +54,7 @@ PythonFinder.prototype = { }, check: this.checkCommand, arg: this.env.NODE_GYP_FORCE_PYTHON - } ] + }] } var checks = [ @@ -97,6 +96,11 @@ PythonFinder.prototype = { before: () => { this.addLog('checking if "python2" can be used') }, check: this.checkCommand, arg: 'python2' + }, + { + before: () => { this.addLog('checking if "python3" can be used') }, + check: this.checkCommand, + arg: 'python3' } ] @@ -140,7 +144,7 @@ PythonFinder.prototype = { return this.fail() } - const args = [ runChecks.bind(this) ] + const args = [runChecks.bind(this)] if (check.arg) { args.unshift(check.arg) } @@ -192,7 +196,7 @@ PythonFinder.prototype = { checkPyLauncher: function checkPyLauncher (errorCallback) { this.log.verbose( `- executing "${this.pyLauncher}" to get Python 2 executable path`) - this.run(this.pyLauncher, [ '-2', ...this.argsExecutable ], false, + this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false, function (err, execPath) { // Possible outcomes: same as checkCommand if (err) { @@ -286,7 +290,7 @@ PythonFinder.prototype = { // X const info = [ '**********************************************************', - 'You need to install the latest version of Python 2.7.', + 'You need to install the latest version of Python.', 'Node-gyp should be able to find and use Python. If not,', 'you can try one of the following options:', `- Use the switch --python="${pathExample}"`, |