From 73e1edaaf012daf50cd8be4eb46cde3c38f07e76 Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Sat, 20 Feb 2021 22:10:15 -0500 Subject: [PATCH] utils/envs: fix envs in MSYS2 always broken 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. --- poetry/utils/env.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/poetry/utils/env.py b/poetry/utils/env.py index ff78bf0161b..28999a0fbb0 100644 --- a/poetry/utils/env.py +++ b/poetry/utils/env.py @@ -22,6 +22,7 @@ from typing import Union import packaging.tags +import sysconfig import tomlkit import virtualenv @@ -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