Skip to content

Commit 20f998c

Browse files
committed
ENH: Simplify venv directory detection in macOS Python build script
- Adjusted logic to streamline `venv_dir` determination. - Removed redundant conditional checks for `pip3` executable existence.
1 parent f41569f commit 20f998c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎scripts/macos_build_python_instance.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,17 @@ def venv_paths(self) -> None:
162162
"""
163163
# First determine if py_env is the full path to a python environment
164164
_command_line_pip_executable = Path(self.py_env) / "bin" / "pip3"
165-
if _command_line_pip_executable.exists():
166-
venv_dir = Path(self.py_env)
167-
else:
165+
166+
venv_dir = Path(self.py_env)
167+
if not _command_line_pip_executable.exists():
168168
venv_root_dir: Path = self.build_dir_root / "venvs"
169169
_venvs_dir_list = create_macos_venvs(self.py_env, venv_root_dir)
170170
if len(_venvs_dir_list) != 1:
171171
raise ValueError(
172172
f"Expected exactly one venv for {self.py_env}, found {_venvs_dir_list}"
173173
)
174174
venv_dir = _venvs_dir_list[0]
175-
python_executable = venv_dir / "bin" / "python3"
175+
python_executable = venv_dir / "bin" / "python3"
176176

177177
self.echo_check_call([python_executable, "-m", "pip", "install", "--upgrade", "pip"])
178178
self.echo_check_call(

0 commit comments

Comments
 (0)