Skip to content

Commit

Permalink
utils/env: improve migw detection on windows
Browse files Browse the repository at this point in the history
When running `python` within the various shells made available on 
Windows by MSys2, `sysconfig.get_platform()` returns:

* MSys2         : `msys-3.2.0-x86-64`
* MinGW x32     : `mingw_i686`
* MinGW x64     : `mingw_x86_64`
* MinGW UCRT64  : `mingw_x86_64_ucrt`
* MinGW Clang64 : `mingw_x86_64_clang`

In the case that `sysconfig.get_platform()` *does* return `mingw` (with
no suffix), this change should still work as expected.

Related-to: #3713
  • Loading branch information
s0600204 authored Oct 8, 2021
1 parent aabf9d9 commit ee67aa8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ class Env:

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

if not self._is_windows or self._is_mingw:
bin_dir = "bin"
Expand Down

0 comments on commit ee67aa8

Please sign in to comment.