From d106c2f8dfdf465c0583bfc50aca4d7d74fefbfc Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Mon, 18 Dec 2017 18:46:14 +0100 Subject: [PATCH] common.get_meson(): use MESONINTROSPECT if present If meson has set this, it takes priority over whatever we may find in PATH. --- common.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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