Skip to content

Commit

Permalink
Merge pull request #4329 from python-poetry/fix-system-env-detection
Browse files Browse the repository at this point in the history
Fix system environment detection
  • Loading branch information
sdispater authored Jul 30, 2021
2 parents 89575f6 + 7e7d75b commit b54f2dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def get(self, reload: bool = False) -> Union["VirtualEnv", "SystemEnv"]:
create_venv = self._poetry.config.get("virtualenvs.create", True)

if not create_venv:
return SystemEnv(Path(sys.prefix))
return self.get_system_env()

venv_path = self._poetry.config.get("virtualenvs.path")
if venv_path is None:
Expand All @@ -603,7 +603,7 @@ def get(self, reload: bool = False) -> Union["VirtualEnv", "SystemEnv"]:
venv = venv_path / name

if not venv.exists():
return SystemEnv(Path(sys.prefix))
return self.get_system_env()

return VirtualEnv(venv)

Expand Down Expand Up @@ -872,7 +872,7 @@ def create_venv(
"</>"
)

return SystemEnv(Path(sys.prefix))
return self.get_system_env()

io.write_line(
"Creating virtualenv <c1>{}</> in {}".format(name, str(venv_path))
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def get_system_env(cls, naive: bool = False) -> "SystemEnv":
else:
prefix = base_prefix

return SystemEnv(prefix, base_prefix)
return SystemEnv(prefix)

@classmethod
def get_base_prefix(cls) -> Path:
Expand Down

0 comments on commit b54f2dc

Please sign in to comment.