Skip to content

Commit

Permalink
Small fix related to poor review by me
Browse files Browse the repository at this point in the history
  • Loading branch information
carlvitzthum committed Nov 7, 2019
1 parent 25d1dbc commit 3854628
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions aws_lambda/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ def _filter_blacklist(package):
pip.main(['install', package, '-t', path, '--ignore-installed', '--no-cache-dir'])


def pip_install_to_target(path, requirements=False, local_package=None):
def pip_install_to_target(path, requirements=None, local_package=None):
"""
For a given active virtualenv, gather all installed pip packages then
copy (re-install) them to the path provided.
Args:
path (str): Path to copy installed pip packages to.
requirements (bool):
requirements (str):
If set, only the packages in the requirements.txt
file are installed.
The requirements.txt file needs to be in the same directory as the
Expand All @@ -169,12 +169,15 @@ def pip_install_to_target(path, requirements=False, local_package=None):
None
"""
packages = []
if requirements and os.path.exists(requirements):
log.info('Gathering requirement from %s' % requirements)
data = read_file(requirements)
packages.extend(data.splitlines())
else:
log.error('Could not load requirements from: %s (does it exist?)' % requirements)
if requirements:
if os.path.exists(requirements):
log.info('Gathering requirement from %s' % requirements)
data = read_file(requirements)
packages.extend(data.splitlines())
else:
log.error('Could not load requirements from: %s (does it exist?)'
% requirements)

if local_package is not None:
packages.append(local_package)
if packages:
Expand Down

0 comments on commit 3854628

Please sign in to comment.