From 4124022a6b59b7b62c7d0c7c4bb9d258227cb7b7 Mon Sep 17 00:00:00 2001 From: nitro Date: Fri, 1 Feb 2019 10:28:27 -0500 Subject: [PATCH] Support Pipenv This still defaults to `pip` if `requirements.txt` is found but if it's not found and a `Pipfile` is found, it will use `pipenv` instead of `pip` to install dependencies --- build.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/build.py b/build.py index 33304d8..be1076f 100644 --- a/build.py +++ b/build.py @@ -136,12 +136,18 @@ def create_zip_file(source_dir, target_file): # Install dependencies into the temporary directory. if runtime.startswith('python'): requirements = os.path.join(temp_dir, 'requirements.txt') - if os.path.exists(requirements): + pipfile = os.path.join(temp_dir, 'Pipfile') + requirements_exists = os.path.exists(requirements) + pipfile_exists = os.path.exists(pipfile) + if requirements_exists or pipfile_exists: with cd(temp_dir): - if runtime.startswith('python3'): - pip_command = 'pip3' - else: - pip_command = 'pip2' + if requirements_exists: + if runtime.startswith('python3'): + pip_command = 'pip3' + else: + pip_command = 'pip2' + elif pipfile_exists: + pip_command = 'pipenv' run( pip_command, 'install',