aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-09-08 00:38:17 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2016-09-08 21:51:48 +0300
commit6f2b29e0f7443b2eba10fba47851e6e00c06bd86 (patch)
tree37a725fe90781814dae98c59d55b27cf50a7b177 /mesonbuild/interpreter.py
parentb1e4b8e1432b3883299e199b98e00e29bf8c2762 (diff)
downloadmeson-6f2b29e0f7443b2eba10fba47851e6e00c06bd86.zip
meson-6f2b29e0f7443b2eba10fba47851e6e00c06bd86.tar.gz
meson-6f2b29e0f7443b2eba10fba47851e6e00c06bd86.tar.bz2
Can use files() in run_command.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 361e0aa..1ef4133 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -144,6 +144,7 @@ class RunProcess(InterpreterObject):
cwd = os.path.join(source_dir, subdir)
child_env = os.environ.copy()
child_env.update(env)
+ mlog.debug('Running command:', ' '.join(command_array))
try:
return subprocess.Popen(command_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=child_env, cwd=cwd)
@@ -1385,9 +1386,19 @@ class Interpreter():
cmd = [cmd]
else:
raise InterpreterException('First argument is of incorrect type.')
- check_stringlist(cargs, 'Run_command arguments must be strings.')
- args = cmd + cargs
+ expanded_args = []
+ for a in mesonlib.flatten(cargs):
+ if isinstance(a, str):
+ expanded_args.append(a)
+ elif isinstance(a, mesonlib.File):
+ if a.is_built:
+ raise InterpreterException('Can not use generated files in run_command.')
+ expanded_args.append(os.path.join(self.environment.get_source_dir(), str(a)))
+ else:
+ raise InterpreterException('Run_command arguments must be strings or the output of files().')
+ args = cmd + expanded_args
in_builddir = kwargs.get('in_builddir', False)
+ mlog.debug('Running command:', ' '.join(args))
if not isinstance(in_builddir, bool):
raise InterpreterException('in_builddir must be boolean.')
return RunProcess(args, self.environment.source_dir, self.environment.build_dir,