UNPKG

@nu-art/commando

Version:
31 lines (30 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Commando_Python3 = void 0; const BaseCommando_1 = require("../core/BaseCommando"); const programming_1 = require("./programming"); const class_merger_1 = require("../core/class-merger"); const basic_1 = require("./basic"); const ts_common_1 = require("@nu-art/ts-common"); const Super = (0, class_merger_1.MergeClass)(BaseCommando_1.BaseCommando, programming_1.Commando_Programming, basic_1.Commando_Basic); const DefaultVenvFolder = '.venv'; class Commando_Python3 extends Super { sourceVenv(venvFolder = DefaultVenvFolder) { this.append(`source ${venvFolder}/bin/activate`); return this; } async installVenv(venvFolder = DefaultVenvFolder) { this.append(`python3 -m venv ${venvFolder}`); await this.execute((stdout, stderr, exitCode) => { if (exitCode !== 0) throw new ts_common_1.Exception(`Error installing VENV - exit code (${exitCode})`); }); return this; } async installRequirements(pathToRequirementsFile = './requirements.txt') { await this.append(`pip3 install -r ${pathToRequirementsFile}`) .execute(); return this; } } exports.Commando_Python3 = Commando_Python3;