aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.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/interpreter.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/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 79a531d..d6f76e9 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -22,7 +22,7 @@ from . import optinterpreter
from . import compilers
from .wrap import wrap
from . import mesonlib
-from .mesonlib import FileMode, Popen_safe
+from .mesonlib import FileMode, Popen_safe, get_meson_script
from .dependencies import InternalDependency, Dependency
from .interpreterbase import InterpreterBase
from .interpreterbase import check_stringlist, noPosargs, noKwargs, stringArgs
@@ -72,20 +72,21 @@ class TryRunResultHolder(InterpreterObject):
class RunProcess(InterpreterObject):
- def __init__(self, command_array, source_dir, build_dir, subdir, in_builddir=False):
+ def __init__(self, command_array, source_dir, build_dir, subdir, mesonintrospect, in_builddir=False):
super().__init__()
- pc, self.stdout, self.stderr = self.run_command(command_array, source_dir, build_dir, subdir, in_builddir)
+ pc, self.stdout, self.stderr = self.run_command(command_array, source_dir, build_dir, subdir, mesonintrospect, in_builddir)
self.returncode = pc.returncode
self.methods.update({'returncode': self.returncode_method,
'stdout': self.stdout_method,
'stderr': self.stderr_method,
})
- def run_command(self, command_array, source_dir, build_dir, subdir, in_builddir):
+ def run_command(self, command_array, source_dir, build_dir, subdir, mesonintrospect, in_builddir):
cmd_name = command_array[0]
env = {'MESON_SOURCE_ROOT': source_dir,
'MESON_BUILD_ROOT': build_dir,
- 'MESON_SUBDIR': subdir}
+ 'MESON_SUBDIR': subdir,
+ 'MESONINTROSPECT': mesonintrospect}
if in_builddir:
cwd = os.path.join(build_dir, subdir)
else:
@@ -1474,8 +1475,8 @@ class Interpreter(InterpreterBase):
in_builddir = kwargs.get('in_builddir', False)
if not isinstance(in_builddir, bool):
raise InterpreterException('in_builddir must be boolean.')
- return RunProcess(args, self.environment.source_dir, self.environment.build_dir,
- self.subdir, in_builddir)
+ return RunProcess(args, self.environment.source_dir, self.environment.build_dir, self.subdir,
+ get_meson_script(self.environment, 'mesonintrospect'), in_builddir)
@stringArgs
def func_gettext(self, nodes, args, kwargs):