From a41b34e44ba5992249e3010e78a7c8ac7a271c44 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 20 Sep 2017 12:45:25 -0400 Subject: [PATCH] PIPENV_DONT_EAT_EDITABLES --- pipenv/environments.py | 3 +++ pipenv/utils.py | 37 +++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/pipenv/environments.py b/pipenv/environments.py index 6e947550..06c0cf1f 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -18,6 +18,9 @@ PIPENV_COLORBLIND = os.environ.get('PIPENV_COLORBLIND') # Disable spinner for better test and deploy logs (for the unworthy). PIPENV_NOSPIN = os.environ.get('PIPENV_NOSPIN') +# Tells pipenv to not try to install -e dependencies to get their dependency information. +PIPENV_DONT_EAT_EDITABLES = os.environ.get('PIPENV_DONT_EAT_EDITABLES') + # Tell Pipenv to default to yes at all prompts. PIPENV_YES = os.environ.get('PIPENV_YES') diff --git a/pipenv/utils.py b/pipenv/utils.py index 9205b54a..729d8c79 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -16,6 +16,8 @@ from piptools.repositories.pypi import PyPIRepository from piptools.scripts.compile import get_pip_command from piptools import logging +from .environments import PIPENV_DONT_EAT_EDITABLES + # List of version control systems we support. VCS_LIST = ('git', 'svn', 'hg', 'bzr') FILE_LIST = ('http://', 'https://', 'ftp://', 'file:///') @@ -141,28 +143,31 @@ def best_matches_from(path, which, which_pip, project): yield line.split('for')[1].strip() setup_py_path = os.path.abspath(os.sep.join([path, 'setup.py'])) - if os.path.isfile(setup_py_path): + if os.path.isfile(setup_py_path) and not PIPENV_DONT_EAT_EDITABLES: return list(gen(setup_py_path, which)) else: - destination = os.path.abspath(os.sep.join([project.virtualenv_location, 'src'])) + if not PIPENV_DONT_EAT_EDITABLES: + destination = os.path.abspath(os.sep.join([project.virtualenv_location, 'src'])) - # Install the package into the virtualenvironment tree. - c = delegator.run( - '{0} install -e {1} --no-deps --src {2} -v'.format( - which_pip(), - path, - shellquote(destination) + # Install the package into the virtualenvironment tree. + c = delegator.run( + '{0} install -e {1} --no-deps --src {2} -v'.format( + which_pip(), + path, + shellquote(destination) + ) ) - ) - result = None - for line in c.out.split('\n'): - line = line.strip() - if line.startswith('Installed'): - result = line[len('Installed '):].strip() + result = None + for line in c.out.split('\n'): + line = line.strip() + if line.startswith('Installed'): + result = line[len('Installed '):].strip() - setup_py_path = os.path.abspath(os.sep.join([(result or ''), 'setup.py'])) + setup_py_path = os.path.abspath(os.sep.join([(result or ''), 'setup.py'])) - return list(gen(setup_py_path, which)) + return list(gen(setup_py_path, which)) + else: + return [] def resolve_deps(deps, which, which_pip, project, sources=None, verbose=False, python=False, clear=False):