diff --git a/common.py b/common.py index e9b2745e1f..f88b65ffa0 100644 --- a/common.py +++ b/common.py @@ -2,6 +2,7 @@ import argparse import os import shutil import subprocess +import shlex ROOTDIR = os.path.abspath(os.path.dirname(__file__)) @@ -58,6 +59,21 @@ def get_meson(): if os.path.exists(meson): return meson + mesonintrospect = os.environ.get('MESONINTROSPECT', '') + for comp in shlex.split (mesonintrospect): + # mesonintrospect might look like "/usr/bin/python /somewhere/meson introspect", + # let's not get tricked + if 'python' in os.path.basename (comp): + continue + if os.path.exists (comp): + mesondir = os.path.dirname(comp) + if mesonintrospect.endswith('.py'): + meson = os.path.join(mesondir, 'meson.py') + else: + meson = os.path.join(mesondir, 'meson') + if os.path.exists (meson): + return meson + meson = accept_command(["meson.py", "meson"]) return meson