mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 14:50:16 +00:00
Merge pull request #2369 from pypa/bugfix-2273
Make `PIPENV_VIRTUALENV` global
This commit is contained in:
+4
-2
@@ -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, '
|
||||
|
||||
Reference in New Issue
Block a user