Fix buggy implementation of --system check

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-04-22 11:24:10 -04:00
parent 0552ad23c1
commit aefaff9f12
+4 -3
View File
@@ -69,6 +69,7 @@ from .environments import (
PIPENV_DOTENV_LOCATION,
PIPENV_SHELL,
PIPENV_PYTHON,
PIPENV_VIRTUALENV,
)
# Backport required for earlier versions of Python.
@@ -247,12 +248,12 @@ def import_from_code(path='.'):
def ensure_pipfile(validate=True, skip_requirements=False, system=False):
"""Creates a Pipfile for the project, if it doesn't exist."""
global USING_DEFAULT_PYTHON
global USING_DEFAULT_PYTHON, PIPENV_VIRTUALENV
# Assert Pipfile exists.
python = which('python') if not (USING_DEFAULT_PYTHON or system) else None
if project.pipfile_is_empty:
# Show an error message and exit if system is passed and no pipfile exists
if system:
if system and not PIPENV_VIRTUALENV:
click.echo(
'{0}: --system is intended to be used for pre-existing Pipfile '
'installation, not installation of specific packages. Aborting.'.format(
@@ -1756,7 +1757,7 @@ def do_install(
keep_outdated = project.settings.get('keep_outdated')
remote = requirements and is_valid_url(requirements)
# Warn and exit if --system is used without a pipfile.
if system and package_name:
if system and package_name and not PIPENV_VIRTUALENV:
click.echo(
'{0}: --system is intended to be used for Pipfile installation, '
'not installation of specific packages. Aborting.'.format(