From c0c075c1298ad9018a62d75a632af1c0d0d7d0f8 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 2 Oct 2018 06:13:44 +0200 Subject: Make custom dist scripts accept arguments. meson.add_dist_script, introduced in #3906, did not accept any arguments other than script name. Since all other meson.add_*_script methods do accept args, this makes the dist script accept them as well. --- mesonbuild/scripts/dist.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'mesonbuild/scripts/dist.py') diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/scripts/dist.py index 68cfcd0..56ac585 100644 --- a/mesonbuild/scripts/dist.py +++ b/mesonbuild/scripts/dist.py @@ -81,16 +81,17 @@ def run_dist_scripts(dist_root, dist_scripts): env = os.environ.copy() env['MESON_DIST_ROOT'] = dist_root for d in dist_scripts: - print('Processing dist script %s' % d) - ddir, dname = os.path.split(d) - ep = ExternalProgram(dname, - search_dir=os.path.join(dist_root, ddir), - silent=True) - if not ep.found(): - sys.exit('Script %s could not be found in dist directory' % d) - pc = subprocess.run(ep.command, env=env) - if pc.returncode != 0: - sys.exit('Dist script errored out') + script = d['exe'] + args = d['args'] + name = ' '.join(script + args) + print('Running custom dist script {!r}'.format(name)) + try: + rc = subprocess.call(script + args, env=env) + if rc != 0: + sys.exit('Dist script errored out') + except OSError: + print('Failed to run dist script {!r}'.format(name)) + sys.exit(1) def git_have_dirty_index(src_root): -- cgit v1.1