Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix system environment detection #4329

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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