Repository: mesonbuild/meson

Issue:
[Feature request, enhancement, minor] Please consider adding the pacman command after error "ERROR: This python3 seems to be msys/python on MSYS2 Windows, which is known to have path semantics incompatible with Meson"
Hey meson-folks,

Allow me to explain the issue first a bit. Today I compiled my first .exe on windows \o/ via msys2. And it worked!
(I am a linux person, so ... I have tons of ruby scripts that I use for batch-compiling everything.)

Anyway. Meson is very popular and for this we need python; python3.

The default install I did on windows msys2 was via pacman.

The message I get when I try to use meson 0.58.0 is this:

"ERROR: This python3 seems to be msys/python on MSYS2 Windows, which is known to have path semantics incompatible with Meson
ERROR: Please install and use mingw-w64-i686-python3 and/or mingw-w64-x86_64-python3 with Pacman"

See also here:

https://github.com/mesonbuild/meson/issues/8173

Obviously the best would be to get rid of it, and have meson just work as-is. But alright. ;)

Anyway - I found the command:

"pacman -S mingw-w64-i686-meson mingw-w64-i686-pkg-config"

I actually don't know pacman. :P

So that helped me.

Could this be included as an example, after the ERROR please? It may help future people who run
into this issue.

Perhaps show both variants, the other for 64 bit too, so people can pick. But I think this may
be better, because people can just copy/paste that command. So perhaps two more sentences
after the current ERROR message, would be appropriate, without becoming too overly verbose.

PS: You can state that it is not the job of meson to show this. Fair enough. But! Why does it then
mention the error "ERROR: Please install and use mingw-w64-i686-python3 and/or mingw-w64-x86_64-python3 with Pacman"?
So if it already does so, a copy/paste-able command would be better, IMO, after the explanation.


Discussion:
@rubyFeedback Seems like you could submit a PR pretty easily for this. There aren't many windows devs that contribute to Meson. Even this little bit helps.
It's a invalid error hints
Should be
```
ERROR: This python3 seems to be msys/python on MSYS2 Windows, which is known to have path semantics incompatible with Meson
ERROR: Please install and use mingw-w64-i686-meson  and/or mingw-w64-x86_64-meson  with Pacman

```

Resolving patch:
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -29,7 +29,6 @@
 from . import mlog
 from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata, mcompile, mdevenv
 from .mesonlib import MesonException, MesonBugException
-from .environment import detect_msys2_arch
 from .wrap import wraptool
 from .scripts import env2mfile
 
@@ -235,13 +234,9 @@ def run(original_args, mainfile):
     ensure_stdout_accepts_unicode()
 
     # https://github.com/mesonbuild/meson/issues/3653
-    if sys.platform.lower() == 'msys':
-        mlog.error('This python3 seems to be msys/python on MSYS2 Windows, which is known to have path semantics incompatible with Meson')
-        msys2_arch = detect_msys2_arch()
-        if msys2_arch:
-            mlog.error('Please install and use mingw-w64-i686-python3 and/or mingw-w64-x86_64-python3 with Pacman')
-        else:
-            mlog.error('Please download and use Python as detailed at: https://mesonbuild.com/Getting-meson.html')
+    if sys.platform == 'cygwin' and os.environ.get('MSYSTEM', '') not in ['MSYS', '']:
+        mlog.error('This python3 seems to be msys/python on MSYS2 Windows, but you are in a MinGW environment')
+        mlog.error('Please install and use mingw-w64-x86_64-python3 and/or mingw-w64-x86_64-meson with Pacman')
         return 2
 
     # Set the meson command that will be used to run scripts and so on


Test patch: