From c86a7ea4d828451bc8ca388fd125a78efb56a9e1 Mon Sep 17 00:00:00 2001 From: frostming Date: Wed, 21 Nov 2018 12:02:38 +0800 Subject: [PATCH] Fix the is_in_virtualenv condition --- pipenv/environments.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pipenv/environments.py b/pipenv/environments.py index 45a4f6b857..a4972bbba8 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -97,10 +97,9 @@ Default is 3. See also ``PIPENV_NO_INHERIT``. """ -PIPENV_MAX_RETRIES = int(os.environ.get( - "PIPENV_MAX_RETRIES", - "1" if PIPENV_IS_CI else "0", -)) +PIPENV_MAX_RETRIES = int( + os.environ.get("PIPENV_MAX_RETRIES", "1" if PIPENV_IS_CI else "0") +) """Specify how many retries Pipenv should attempt for network requests. Default is 0. Automatically set to 1 on CI environments for robust testing. @@ -222,7 +221,9 @@ NOTE: This only affects the ``install`` and ``uninstall`` commands. """ -PIPENV_PYUP_API_KEY = os.environ.get("PIPENV_PYUP_API_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0") +PIPENV_PYUP_API_KEY = os.environ.get( + "PIPENV_PYUP_API_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0" +) # Internal, support running in a different Python from sys.executable. PIPENV_PYTHON = os.environ.get("PIPENV_PYTHON") @@ -243,9 +244,9 @@ # Internal, the default shell to use if shell detection fails. PIPENV_SHELL = ( - os.environ.get("SHELL") or - os.environ.get("PYENV_SHELL") or - os.environ.get("COMSPEC") + os.environ.get("SHELL") + or os.environ.get("PYENV_SHELL") + or os.environ.get("COMSPEC") ) # Internal, to tell whether the command line session is interactive. @@ -279,7 +280,9 @@ def is_quiet(threshold=-1): def is_in_virtualenv(): pipenv_active = os.environ.get("PIPENV_ACTIVE") virtual_env = os.environ.get("VIRTUAL_ENV") - return (PIPENV_USE_SYSTEM or virtual_env) and not pipenv_active + return (PIPENV_USE_SYSTEM or virtual_env) and not ( + pipenv_active or PIPENV_IGNORE_VIRTUALENVS + ) PIPENV_SPINNER_FAIL_TEXT = fix_utf8(u"✘ {0}") if not PIPENV_HIDE_EMOJIS else ("{0}")