summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-06-03 15:00:53 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-06-03 18:19:52 +0530
commita3c8cae0df63ca902b64d4b3584caf8c6f67245e (patch)
tree4471b623b83d8e17ce56e299fad22341cf3cba5b /mesonbuild/mesonmain.py
parent60d414f64924c1b5a75cedcca27889a9198c18c5 (diff)
downloadmeson-nirbheek/document-msys-installation-steps.tar.gz
Error out when someone tries to use msys/python to run Mesonnirbheek/document-msys-installation-steps
This mistake seems to be a very common hiccup for people trying to use Meson with MSYS2 on Windows from git or with pip. msys/python uses POSIX paths with '/' as the root instead of a drive like `C:/`, and also does not identify the platform as Windows. This means that configure checks will be wrong, and many build tools will be unable to parse the paths that are returned by functions in Python such as shutil.which. Closes https://github.com/mesonbuild/meson/issues/3653
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r--mesonbuild/mesonmain.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index c03ef9ba9..67d5a6c7d 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -23,6 +23,7 @@ from . import build
from . import mconf, mintro, mtest, rewriter, minit
from . import mlog, coredata
from .mesonlib import MesonException
+from .environment import detect_msys2_arch
from .wrap import WrapMode, wraptool
default_warning = '1'
@@ -287,6 +288,15 @@ def run(original_args, mainfile):
print('You have python %s.' % sys.version)
print('Please update your environment')
return 1
+ # 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 from www.python.org')
+ return 2
# Set the meson command that will be used to run scripts and so on
set_meson_command(mainfile)
args = original_args[:]