From 50fb7d37abc02b674b66071b51b1a2862fabb3cd Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Tue, 15 Aug 2017 20:05:56 +0300 Subject: Make all functionality invokable via the main Meson binary, which can be a Windows .exe file. --- mesonbuild/scripts/commandrunner.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'mesonbuild/scripts/commandrunner.py') 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 -- cgit v1.1