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 poetry shell on Windows when using Python installed from msys2 #8644

Merged
merged 6 commits into from
Nov 13, 2023
Merged
Changes from 2 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: 7 additions & 1 deletion src/poetry/utils/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ def get(cls) -> Shell:

def activate(self, env: VirtualEnv) -> int | None:
activate_script = self._get_activate_script()
bin_dir = "Scripts" if WINDOWS else "bin"
if WINDOWS:
bin_path = os.path.join(env.path, "Scripts")
ArchGuyWu marked this conversation as resolved.
Show resolved Hide resolved
# Python innstalled via msys2 on Windows might produce a POSIX-like venv
# See https://github.com/python-poetry/poetry/issues/8638
bin_dir = "Scripts" if os.path.exists(bin_path) else "bin"
else:
bin_dir = "bin"
activate_path = env.path / bin_dir / activate_script

# mypy requires using sys.platform instead of WINDOWS constant
Expand Down
Loading