aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2018-10-02 06:13:44 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-10-04 21:20:57 +0300
commitc0c075c1298ad9018a62d75a632af1c0d0d7d0f8 (patch)
treecadf15c9de967df71bf047233790d722faf46ff1 /mesonbuild/scripts
parent577d6bfdb483452b2a9434ba3a1d7031094b0cbd (diff)
downloadmeson-c0c075c1298ad9018a62d75a632af1c0d0d7d0f8.zip
meson-c0c075c1298ad9018a62d75a632af1c0d0d7d0f8.tar.gz
meson-c0c075c1298ad9018a62d75a632af1c0d0d7d0f8.tar.bz2
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.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/dist.py21
1 files changed, 11 insertions, 10 deletions
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):