diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2022-04-01 11:42:27 +0200 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-04-01 13:15:33 -0400 |
commit | 26903d7b12cde17581d4d5ec00d52edee8644965 (patch) | |
tree | 7872586dd1c69e141a13e5a34e7b65975a042585 /mesonbuild/mesonmain.py | |
parent | cc8e67ce59c3b0274bc9f10cb287d5254aa74166 (diff) | |
download | meson-26903d7b12cde17581d4d5ec00d52edee8644965.zip meson-26903d7b12cde17581d4d5ec00d52edee8644965.tar.gz meson-26903d7b12cde17581d4d5ec00d52edee8644965.tar.bz2 |
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 #8726
Also addresses the concern raised in
https://github.com/mesonbuild/meson/issues/3653#issuecomment-474122564
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r-- | mesonbuild/mesonmain.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 5d720f0..5c24931 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -29,7 +29,6 @@ from . import mesonlib 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 |