Add Support for MSYS2 in Windows
See original GitHub issueThanks @asottile and all the other contributors for the great tool! ❤️ 👍
I am one of the maintainers for Gaphor, and we make heavy use of pre-commit as part of our work flow. It is also built in GTK, and we have to use MSYS2 to build the app for Windows. I know it is a pretty niche environment to support, but it would be really great if we could make it happen.
Current Behavior
version information
pre-commit version: 2.7.1
sys.version:
3.8.5 (default, Sep 7 2020, 18:26:56) [GCC 10.2.0 64 bit (AMD64)]
sys.executable: c:/tools/msys64/home/dyeaw/gaphor/.venv/bin/python.exe
os.name: nt
sys.platform: win32
error information
An unexpected error has occurred: FileNotFoundError: [WinError 3] The system cannot find the path specified: '/home/dyeaw/gaphor'
Traceback (most recent call last):
File "C:/tools/msys64/home/dyeaw/gaphor/.venv/lib/python3.8/site-packages/pre_commit/error_handler.py", line 63, in error_handler
yield
File "C:/tools/msys64/home/dyeaw/gaphor/.venv/lib/python3.8/site-packages/pre_commit/main.py", line 343, in main
_adjust_args_and_chdir(args)
File "C:/tools/msys64/home/dyeaw/gaphor/.venv/lib/python3.8/site-packages/pre_commit/main.py", line 163, in _adjust_args_and_chdir
os.chdir(toplevel)
FileNotFoundError: [WinError 3] The system cannot find the path specified: '/home/dyeaw/gaphor'
Updates Needed
- Update pre-commit to make use of the
cygpath
command to convert the path to the standard Windows path format after it gets the top-level path from git. - Remove cygwin warnings about incompatible Python+git versions if in the MSYS2 environment
- Make upstream updates to setuptools_scm to patch additional path conversions for similar things as 1 above.
My plan, as long is everyone is good with adding support for this environment, is to submit a PR for the first two, and then I’ll start to work with the setuptools_scm team to see if I can fix the third one as well.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
MSYS2
MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software.
Read more >MSYS2-Installation
The installers and base archives only contain the tools necessary to 1) start MSYS2 2) update the pre-installed packages and 3) install new...
Read more >MSYS2-Introduction
MSYS2 is software distribution and a building platform for Windows. It provides a Unix-like environment, a command-line interface and a software repository ...
Read more >Terminals - MSYS2
The new Windows Terminal application, which by default supports cmd, powershell and WSL ... Insert the example profiles shown below under the profiles...
Read more >Porting - MSYS2
Porting. While in our humble opinions, MSYS2 makes collaborative, organised development of open-source software on Windows a workable proposition, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
no problem! thanks for the helpful comment as well 😃
If anyone stumbles on this issue in the future and you want to run MINGW Python:
pacman -R git
choco install git
Git-for-windows is compiled using MINGW64 as well, and returns the correct Windows paths. Thanks @asottile for the guidance, I don’t think this is well known for MSYS2 users, I’ll see if I can’t add it to their FAQ or other documentation. Sorry for being hard headed 😄.