mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Add utility for pip installation using -t
This commit is contained in:
parent
bfe2976d07
commit
495376ccd4
@ -232,7 +232,7 @@ usage: serverless component create`,
|
||||
|
||||
_installComponentDependencies() {
|
||||
let _this = this;
|
||||
if (_this.runtime === 'nodejs') {
|
||||
if (_this.evt.options.runtime === 'nodejs') {
|
||||
SCli.log('Installing "serverless-helpers" for this component via NPM...');
|
||||
SUtils.npmInstall(path.join(this.S.config.projectPath, this.evt.options.component));
|
||||
} else if (_this.runtime === 'python2.7') {
|
||||
|
||||
@ -539,6 +539,17 @@ exports.npmInstall = function(dir) {
|
||||
process.chdir(process.cwd());
|
||||
};
|
||||
|
||||
/**
|
||||
* Pip install using prefix strategy (not virtualenv), requires a modern `pip` version
|
||||
*/
|
||||
exports.pipPrefixInstall = function(requirements, dir) {
|
||||
if (exec(`pip install -t "${dir}" -r "${requirements}"`, { silent: false }).code !== 0) {
|
||||
throw new SError(`Error executing pip install on ${dir}`, SError.errorCodes.UNKNOWN);
|
||||
}
|
||||
|
||||
process.chdir(process.cwd());
|
||||
};
|
||||
|
||||
/**
|
||||
* Write to console.log if process.env.DEBUG is true
|
||||
* - If we ever want to get more complicated with log levels we should use winston
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user