aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-25 08:07:46 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-03-28 00:55:01 +0530
commit27f5f0a9633b310f537f09ba0fdd79d86fcb962a (patch)
treef785006e3f80095df05d09bf3b7aa50f0def82fe /mesonbuild/mesonlib.py
parent53795d89df48ca722b018ff8720669deb6209be4 (diff)
downloadmeson-27f5f0a9633b310f537f09ba0fdd79d86fcb962a.zip
meson-27f5f0a9633b310f537f09ba0fdd79d86fcb962a.tar.gz
meson-27f5f0a9633b310f537f09ba0fdd79d86fcb962a.tar.bz2
Export MESONINTROSPECT to postconf/install/run_command scripts
Points to the `mesonintrospect.py` script corresponding to the currently-running version of Meson. Includes a test for all three methods of running scripts/commands. Closes https://github.com/mesonbuild/meson/issues/1385
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index c7368d5..345a184 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -173,6 +173,15 @@ class File:
def relative_name(self):
return os.path.join(self.subdir, self.fname)
+def get_meson_script(env, script):
+ '''
+ Given the path of `meson.py`/`meson`, get the path of a meson script such
+ as `mesonintrospect` or `mesontest`.
+ '''
+ meson_py = env.get_build_command()
+ (base, ext) = os.path.splitext(meson_py)
+ return os.path.join(os.path.dirname(base), script + ext)
+
def get_compiler_for_source(compilers, src):
for comp in compilers:
if comp.can_compile(src):