Skip to content

Commit

Permalink
consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Apr 22, 2023
1 parent 0184cd0 commit 220855b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,9 @@ def activate(self, python: str) -> Env:
patch = python_version.text

create = False
is_root_venv = self.use_in_project_venv()
# If we are required to create the virtual environment in the root folder,
# If we are required to create the virtual environment in the project directory,
# create or recreate it if needed
if is_root_venv:
if self.use_in_project_venv():
create = False
venv = self.in_project_venv
if venv.exists():
Expand Down Expand Up @@ -893,8 +892,8 @@ def use_in_project_venv(self) -> bool:
if in_project is not None:
return in_project

root_venv: Path = self._poetry.file.parent / ".venv"
return root_venv.is_dir()
venv: Path = self._poetry.file.parent / ".venv"
return venv.is_dir()

def create_venv(
self,
Expand Down Expand Up @@ -923,7 +922,7 @@ def create_venv(
return env

create_venv = self._poetry.config.get("virtualenvs.create")
root_venv = self.use_in_project_venv()
in_project_venv = self.use_in_project_venv()
prefer_active_python = self._poetry.config.get(
"virtualenvs.prefer-active-python"
)
Expand All @@ -933,7 +932,9 @@ def create_venv(
executable = self._detect_active_python()

venv_path = (
self.in_project_venv if root_venv else self._poetry.config.virtualenvs_path
self.in_project_venv
if in_project_venv
else self._poetry.config.virtualenvs_path
)
if not name:
name = self._poetry.package.name
Expand Down Expand Up @@ -1011,7 +1012,7 @@ def create_venv(
self._poetry.package.python_versions
)

if root_venv:
if in_project_venv:
venv = venv_path
else:
name = self.generate_env_name(name, str(cwd))
Expand Down

0 comments on commit 220855b

Please sign in to comment.