mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix buggy implementation of --system check
Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+4
-3
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user