Merge pull request #4284 from pypa/bugfix/4276

Fix incorrect environment when inside venv
This commit is contained in:
Frost Ming
2020-05-29 15:10:15 +08:00
committed by GitHub
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that system-wide packages will be considered when inside a venv.
+2 -2
View File
@@ -330,11 +330,11 @@ class Project(object):
def get_environment(self, allow_global=False):
# type: (bool) -> Environment
if allow_global:
is_venv = is_in_virtualenv()
if allow_global and not is_venv:
prefix = sys.prefix
else:
prefix = self.virtualenv_location
is_venv = is_in_virtualenv()
sources = self.sources if self.sources else [DEFAULT_SOURCE]
environment = Environment(
prefix=prefix, is_venv=is_venv, sources=sources, pipfile=self.parsed_pipfile,