Description
Description:
When running click in MSYS2 MINGW64 Python environment, click is trying to import tty. This fails due to termios not being a package supported by Windows.
This happens because of the platform detection in _compat.py. The following code detects the platform as being MSYS2 which then tries to use MSYS2 compatible packages:
MSYS2 = sys.platform.startswith("win") and ("GCC" in sys.version)
This does not work when using python packaged with MINGW64 as it still detects the platform as being MSYS2.
Reproduce:
Open a progress bar in MSYS2 MINGW64 Python3 i.e.
with click.progressbar(length=10, label="Downloading") as pbar:
Traceback (most recent call last):
File "C:\msys64\mingw64\lib\python3.10\site-packages\apio\managers\installer.py", line 200, in install
dlpath = self._download(platform_download_url)
File "C:\msys64\mingw64\lib\python3.10\site-packages\apio\managers\installer.py", line 382, in _download
filed.start()
File "C:\msys64\mingw64\lib\python3.10\site-packages\apio\managers\downloader.py", line 68, in start
with click.progressbar(length=chunks, label="Downloading") as pbar:
File "C:\msys64\mingw64\lib\python3.10\site-packages\click\termui.py", line 394, in progressbar
from ._termui_impl import ProgressBar
File "C:\msys64\mingw64\lib\python3.10\site-packages\click_termui_impl.py", line 626, in
import tty
File "C:\msys64\mingw64\lib\python3.10\tty.py", line 5, in
from termios import *
ModuleNotFoundError: No module named 'termios'
Expected Behaviour:
Expect the platform detection to detect the platform as Windows and not MSYS2.
Environment:
- Platform: MSYS2 MINGW64
- Python version: 3.10
- Click version: 7.1.2