backends: do not split command and arguments in ExecutableSerialisation

This is not needed anymore, just make a single field with the whole
command line.
pull/5644/head
Paolo Bonzini 5 years ago
parent b4d313b058
commit d34e532020
  1. 5
      mesonbuild/backend/backends.py
  2. 13
      mesonbuild/scripts/meson_exe.py

@ -69,9 +69,8 @@ class TargetInstallData:
self.optional = optional self.optional = optional
class ExecutableSerialisation: class ExecutableSerialisation:
def __init__(self, fname, cmd_args, env=None, exe_wrapper=None, def __init__(self, cmd_args, env=None, exe_wrapper=None,
workdir=None, extra_paths=None, capture=None): workdir=None, extra_paths=None, capture=None):
self.fname = fname
self.cmd_args = cmd_args self.cmd_args = cmd_args
self.env = env or {} self.env = env or {}
if exe_wrapper is not None: if exe_wrapper is not None:
@ -384,7 +383,7 @@ class Backend:
scratch_file = 'meson_exe_{0}_{1}.dat'.format(basename, digest) scratch_file = 'meson_exe_{0}_{1}.dat'.format(basename, digest)
exe_data = os.path.join(self.environment.get_scratch_dir(), scratch_file) exe_data = os.path.join(self.environment.get_scratch_dir(), scratch_file)
with open(exe_data, 'wb') as f: with open(exe_data, 'wb') as f:
es = ExecutableSerialisation(exe_cmd, cmd_args, env, es = ExecutableSerialisation(exe_cmd + cmd_args, env,
exe_wrapper, workdir, exe_wrapper, workdir,
extra_paths, capture) extra_paths, capture)
pickle.dump(es, f) pickle.dump(es, f)

@ -42,10 +42,10 @@ def run_exe(exe):
if exe.exe_runner: if exe.exe_runner:
if not exe.exe_runner.found(): if not exe.exe_runner.found():
raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found ' raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found '
'wrapper {!r}'.format(exe.fname[0], exe.exe_runner.get_path())) 'wrapper {!r}'.format(exe.cmd_args[0], exe.exe_runner.get_path()))
cmd = exe.exe_runner.get_command() + exe.fname cmd_args = exe.exe_runner.get_command() + exe.cmd_args
else: else:
cmd = exe.fname cmd_args = exe.cmd_args
child_env = os.environ.copy() child_env = os.environ.copy()
child_env.update(exe.env) child_env.update(exe.env)
if exe.extra_paths: if exe.extra_paths:
@ -61,7 +61,7 @@ def run_exe(exe):
else: else:
child_env['WINEPATH'] = wine_path child_env['WINEPATH'] = wine_path
p = subprocess.Popen(cmd + exe.cmd_args, env=child_env, cwd=exe.workdir, p = subprocess.Popen(cmd_args, env=child_env, cwd=exe.workdir,
close_fds=False, close_fds=False,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
@ -103,10 +103,7 @@ def run(args):
with open(options.unpickle, 'rb') as f: with open(options.unpickle, 'rb') as f:
exe = pickle.load(f) exe = pickle.load(f)
else: else:
exe_cmd = cmd_args[0] exe = ExecutableSerialisation(cmd_args, capture=options.capture)
cmd_args = cmd_args[1:]
exe = ExecutableSerialisation([exe_cmd], cmd_args,
capture=options.capture)
return run_exe(exe) return run_exe(exe)

Loading…
Cancel
Save