Skip to content

Commit

Permalink
utils/envs: fix envs in MSYS2 always broken
Browse files Browse the repository at this point in the history
Fixes #2867, the virtual environment found seems to be broken
messages when running in MSYS2. This change detects when in MSYS2
in order to use the bin directory for the virtualenv instead of
Scripts which is normally used in Windows.
  • Loading branch information
danyeaw committed Feb 21, 2021
1 parent 6eaa298 commit 73e1eda
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from typing import Union

import packaging.tags
import sysconfig
import tomlkit
import virtualenv

Expand Down Expand Up @@ -879,9 +880,13 @@ class Env(object):

def __init__(self, path: Path, base: Optional[Path] = None) -> None:
self._is_windows = sys.platform == "win32"
self._is_mingw = sysconfig.get_platform() == "mingw"

if not self._is_windows or self._is_mingw:
bin_dir = "bin"
else:
bin_dir = "Scripts"
self._path = path
bin_dir = "bin" if not self._is_windows else "Scripts"
self._bin_dir = self._path / bin_dir

self._base = base or path
Expand Down

0 comments on commit 73e1eda

Please sign in to comment.