Merge pull request #2369 from pypa/bugfix-2273

Make `PIPENV_VIRTUALENV` global
This commit is contained in:
Tzu-ping Chung
2018-06-17 20:26:39 +08:00
committed by GitHub
+4 -2
View File
@@ -1261,6 +1261,7 @@ def do_init(
pypi_mirror=None,
):
"""Executes the init functionality."""
global PIPENV_VIRTUALENV
if not system:
if not project.virtualenv_exists:
try:
@@ -1292,7 +1293,7 @@ def do_init(
)
requirements_dir.cleanup()
sys.exit(1)
elif system or allow_global:
elif (system or allow_global) and not (PIPENV_VIRTUALENV):
click.echo(
crayons.red(
u'Pipfile.lock ({0}) out of date, but installation '
@@ -1321,7 +1322,7 @@ def do_init(
if not project.lockfile_exists and not skip_lock:
# Unless we're in a virtualenv not managed by pipenv, abort if we're
# using the system's python.
if (system or allow_global) and not PIPENV_VIRTUALENV:
if (system or allow_global) and not (PIPENV_VIRTUALENV):
click.echo(
'{0}: --system is intended to be used for Pipfile installation, '
'not installation of specific packages. Aborting.'.format(
@@ -1793,6 +1794,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.
global PIPENV_VIRTUALENV
if system and package_name and not PIPENV_VIRTUALENV:
click.echo(
'{0}: --system is intended to be used for Pipfile installation, '