Skip to content

Commit 9c078cf

Browse files
committed
main: Make the msys/python check work again, in some cases
msys/python in MSYS2 pretends to be cygwin in all cases for some time now, so this check was impossible to hit. The underlying confusion it tried to prevent is still there, namely trying to build with mingw but wrongly using a msys/cygwin python/meson. We can use the MSYSTEM env var to detect if we are in a mingw shell, and in case the Python doesn't match we suggest installing mingw variants of both python and meson. Using msys/python + meson in a MSYS environment works fine on the other hand, so no need to error out in that case. Fixes mesonbuild#8726 Also addresses the concern raised in mesonbuild#3653 (comment)
1 parent 3455f21 commit 9c078cf

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

mesonbuild/mesonmain.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from . import mlog
3030
from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata, mcompile, mdevenv
3131
from .mesonlib import MesonException, MesonBugException
32-
from .environment import detect_msys2_arch
3332
from .wrap import wraptool
3433
from .scripts import env2mfile
3534

@@ -235,13 +234,9 @@ def run(original_args, mainfile):
235234
ensure_stdout_accepts_unicode()
236235

237236
# https://github.com/mesonbuild/meson/issues/3653
238-
if sys.platform.lower() == 'msys':
239-
mlog.error('This python3 seems to be msys/python on MSYS2 Windows, which is known to have path semantics incompatible with Meson')
240-
msys2_arch = detect_msys2_arch()
241-
if msys2_arch:
242-
mlog.error('Please install and use mingw-w64-i686-python3 and/or mingw-w64-x86_64-python3 with Pacman')
243-
else:
244-
mlog.error('Please download and use Python as detailed at: https://mesonbuild.com/Getting-meson.html')
237+
if sys.platform == 'cygwin' and os.environ.get('MSYSTEM', '') not in ['MSYS', '']:
238+
mlog.error('This python3 seems to be msys/python on MSYS2 Windows, but you are in a MinGW environment')
239+
mlog.error('Please install and use mingw-w64-x86_64-python3 and/or mingw-w64-x86_64-meson with Pacman')
245240
return 2
246241

247242
# Set the meson command that will be used to run scripts and so on

0 commit comments

Comments
 (0)