diff --git a/README.md b/README.md index da0e913..0440176 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +This project is a fork of the unmaintained repository [cfchou/serverless-python-individually](https://github.com/cfchou/serverless-python-individually) + +It fixes errors due to virtualenv en pip versions. + # serverless-python-individually [![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) diff --git a/index.js b/index.js index 6770f21..870eaa2 100644 --- a/index.js +++ b/index.js @@ -315,10 +315,12 @@ pip3 install -U virtualenv && ${runPy} this.log('Installing packagings: ' + cmd.join(' ')); const ret = ChildProcess.spawnSync(cmd[0], cmd.slice(1)); + ret.stderr = ret.stderr || '' + ret.stdout = ret.stdout || '' this.log(ret.stderr.toString()); this.log(ret.stdout.toString()); - var isNotPipWarning = ret.stderr.indexOf('You are using pip version') < 0; + var isNotPipWarning = ret.stderr.indexOf('You are using pip version') < 0 && ret.stderr.indexOf('A new release of pip') < 0; if (ret.error || (ret.stderr.length != 0 && isNotPipWarning)) { this.log('Unhandled error in pip, not deploying to AWS.'); return BbPromise.reject(ret.error) diff --git a/requirements.py b/requirements.py index 387b867..eb39f83 100644 --- a/requirements.py +++ b/requirements.py @@ -54,7 +54,7 @@ sys.argv = ['', VENV_DIR] try: sys_stdout.write('creating virtualenv {}\n'.format(VENV_DIR).encode()) - virtualenv.main() + virtualenv.cli_run([VENV_DIR]) finally: sys.argv = original