Reuse pythonExecutable variable

This commit is contained in:
probablycorey 2014-06-04 11:09:50 -07:00
parent 1ac40b2673
commit b7bd11a883

View File

@ -2,7 +2,7 @@ var path = require('path');
var fs = require('fs');
var cp = require('child_process');
var execFile = cp.execFile;
var pythonPath = process.env.PYTHON;
var pythonExecutable = process.env.PYTHON;
module.exports = function(cb) {
verifyNode();
@ -24,21 +24,17 @@ function verifyPython27(cb) {
cb();
}
else {
var pythonExecutable;
if (!pythonPath) {
if (!pythonExecutable) {
var systemDrive = process.env.SystemDrive || 'C:\\';
pythonPath = path.join(systemDrive, 'Python27');
pythonExecutable = path.join(systemDrive, 'Python27');
if (fs.existsSync(pythonPath)) {
pythonExecutable = path.join(pythonPath, 'python');
if (fs.existsSync(pythonExecutable)) {
pythonExecutable = path.join(pythonExecutable, 'python');
}
else {
pythonExecutable = 'python';
}
}
else {
pythonExecutable = pythonPath;
}
checkPythonVersion(pythonExecutable, cb);
}