Update error messages

This commit is contained in:
probablycorey 2014-06-04 11:10:14 -07:00
parent b7bd11a883
commit 99af9e2c33

View File

@ -41,27 +41,29 @@ function verifyPython27(cb) {
}
function checkPythonVersion (python, cb) {
var pythonRequiredMessage = "Python 2.7 is required to build Atom. Python 2.7 must be installed at '" + pythonPath + "', or the PYTHON env var must be set to '/path/to/Python27/python.exe', or the Python install directory must be in the path.";
var pythonHelpMessage = "Set the PYTHON env var to '/path/to/Python27/python.exe' if your python is installed in a non-default location.";
execFile(python, ['-c', 'import platform; print(platform.python_version());'], { env: process.env }, function (err, stdout) {
if (err) {
console.log(pythonRequiredMessage);
console.log("Python 2.7 is required to build Atom. An error occured when checking for python '" + err + "'");
console.log(pythonHelpMessage);
process.exit(1);
}
var version = stdout.trim()
var version = stdout.trim();
if (~version.indexOf('+')) {
version = version.replace(/\+/g, '')
version = version.replace(/\+/g, '');
}
if (~version.indexOf('rc')) {
version = version.replace(/rc(.*)$/ig, '')
version = version.replace(/rc(.*)$/ig, '');
}
// Atom requires python 2.7 or better (but not python 3) for node-gyp
// Atom requires python 2.7 or higher (but not python 3) for node-gyp
var versionArray = version.split('.').map(function(num) { return +num; });
var goodPythonVersion = (versionArray[0] === 2 && versionArray[1] >= 7)
var goodPythonVersion = (versionArray[0] === 2 && versionArray[1] >= 7);
if (!goodPythonVersion) {
console.log(pythonRequiredMessage);
console.log("Python 2.7 is required to build Atom. '" + python + "' returns version " + version);
console.log(pythonHelpMessage);
process.exit(1);
}