diff --git a/news/4316.bugfix.rst b/news/4316.bugfix.rst new file mode 100644 index 0000000000..66d4584007 --- /dev/null +++ b/news/4316.bugfix.rst @@ -0,0 +1 @@ +Fix falsely flagging a Homebrew installed Python as a virtual environment diff --git a/pipenv/environments.py b/pipenv/environments.py index 005d0a2d32..d98e36ad92 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -81,7 +81,7 @@ def get_from_env(arg, prefix="PIPENV", check_for_negation=True): # HACK: Prevent invalid shebangs with Homebrew-installed Python: # https://bugs.python.org/issue22490 -_OSX_VENV = os.environ.pop("__PYVENV_LAUNCHER__", None) +os.environ.pop("__PYVENV_LAUNCHER__", None) # Load patched pip instead of system pip os.environ["PIP_SHIMS_BASE_MODULE"] = fs_str("pipenv.patched.notpip") @@ -326,7 +326,7 @@ def get_from_env(arg, prefix="PIPENV", check_for_negation=True): PIPENV_USE_SYSTEM = False PIPENV_VIRTUALENV = None if "PIPENV_ACTIVE" not in os.environ and not PIPENV_IGNORE_VIRTUALENVS: - PIPENV_VIRTUALENV = os.environ.get("VIRTUAL_ENV") or _OSX_VENV + PIPENV_VIRTUALENV = os.environ.get("VIRTUAL_ENV") PIPENV_USE_SYSTEM = bool(PIPENV_VIRTUALENV) # Internal, tells Pipenv to skip case-checking (slow internet connections). @@ -370,7 +370,7 @@ def is_quiet(threshold=-1): def _is_using_venv(): # type: () -> bool """Check for venv-based virtual environment which sets sys.base_prefix""" - return _OSX_VENV is not None or sys.prefix != getattr(sys, "base_prefix", sys.prefix) + return sys.prefix != getattr(sys, "base_prefix", sys.prefix) def _is_using_virtualenv():