@veecode-platform/safira-cli
Version:
Generate a microservice project from your spec.
25 lines (24 loc) • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DoctorPython = void 0;
const tslib_1 = require("tslib");
const version_utils_1 = require("../utils/version-utils");
const properties = tslib_1.__importStar(require("../properties.json"));
const command_execute_1 = require("../command/command-execute");
class DoctorPython {
async execute() {
return command_execute_1.CommandExecute.instance.exec("python3 --version", false).then(stdout => {
if (stdout) {
const pythonVersion = version_utils_1.VersionUtils.extractVersion(stdout, /\d+(\.\d+){2,}/);
if (version_utils_1.VersionUtils.compareVersions(pythonVersion, properties.requirements.python.minimal) >= 0) {
return ("Python is healthy, Version installed " + pythonVersion);
}
throw new Error(`Python is not healthy, Version installed ${pythonVersion}, to adjust this update to version ${properties.requirements.python.minimal}`);
}
throw new Error("Python is not installed");
}).catch(error => {
throw new Error("Python is not installed");
});
}
}
exports.DoctorPython = DoctorPython;