aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/commandrunner.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-08-15 20:05:56 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2017-08-18 12:08:20 +0300
commit50fb7d37abc02b674b66071b51b1a2862fabb3cd (patch)
treed75a57c8f0726f772219979e00b624832038a01a /mesonbuild/scripts/commandrunner.py
parent62aabb5a8be90467603b1348d8ae4c0847bc5d1e (diff)
downloadmeson-50fb7d37abc02b674b66071b51b1a2862fabb3cd.zip
meson-50fb7d37abc02b674b66071b51b1a2862fabb3cd.tar.gz
meson-50fb7d37abc02b674b66071b51b1a2862fabb3cd.tar.bz2
Make all functionality invokable via the main Meson binary,
which can be a Windows .exe file.
Diffstat (limited to 'mesonbuild/scripts/commandrunner.py')
-rw-r--r--mesonbuild/scripts/commandrunner.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py
index 87e3b8b..f99cddb 100644
--- a/mesonbuild/scripts/commandrunner.py
+++ b/mesonbuild/scripts/commandrunner.py
@@ -15,13 +15,14 @@
"""This program is a wrapper to run external commands. It determines
what to run, sets up the environment and executes the command."""
-import sys, os, subprocess, shutil
+import sys, os, subprocess, shutil, shlex
-def run_command(source_dir, build_dir, subdir, mesonintrospect, command, arguments):
+def run_command(source_dir, build_dir, subdir, meson_command, command, arguments):
env = {'MESON_SOURCE_ROOT': source_dir,
'MESON_BUILD_ROOT': build_dir,
'MESON_SUBDIR': subdir,
- 'MESONINTROSPECT': mesonintrospect}
+ 'MESONINTROSPECT': ' '.join([shlex.quote(x) for x in meson_command + ['introspect']]),
+ }
cwd = os.path.join(source_dir, subdir)
child_env = os.environ.copy()
child_env.update(env)
@@ -47,10 +48,16 @@ def run(args):
src_dir = args[0]
build_dir = args[1]
subdir = args[2]
- mesonintrospect = args[3]
- command = args[4]
- arguments = args[5:]
- pc = run_command(src_dir, build_dir, subdir, mesonintrospect, command, arguments)
+ meson_command = args[3]
+ if 'python' in meson_command: # Hack.
+ meson_command = [meson_command, args[4]]
+ command = args[5]
+ arguments = args[6:]
+ else:
+ meson_command = [meson_command]
+ command = args[4]
+ arguments = args[5:]
+ pc = run_command(src_dir, build_dir, subdir, meson_command, command, arguments)
pc.wait()
return pc.returncode