Skip to content

Commit

Permalink
Add a small fix for virtual envs pointing at a base Python install
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Jul 17, 2019
1 parent 442ff52 commit 5654379
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,19 @@ def _bin(self, bin): # type: (str) -> str
"""
bin_path = (self._bin_dir / bin).with_suffix(".exe" if self._is_windows else "")
if not bin_path.exists():
# On Windows, some executables can be in the base path
# This is especially true when installing Python with
# the official installer, where python.exe will be at
# the root of the env path.
# This is an edge case and should not be encountered
# in normal uses but this happens in the sonnet script
# that creates a fake virtual environment pointing to
# a base Python install.
if self._is_windows:
bin_path = (self._path / bin).with_suffix(".exe")
if bin_path.exists():
return str(bin_path)

return bin

return str(bin_path)
Expand Down

0 comments on commit 5654379

Please sign in to comment.