aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-24 04:35:15 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-26 20:46:42 -0400
commit70d94a555004563178878b73274e345adff5b4e8 (patch)
treea5944eecebc2992e322e42364148d63ba73acda8 /mesonbuild/build.py
parentdcaf2d7b3d010526eb5035fec788f1b9a854262c (diff)
downloadmeson-70d94a555004563178878b73274e345adff5b4e8.zip
meson-70d94a555004563178878b73274e345adff5b4e8.tar.gz
meson-70d94a555004563178878b73274e345adff5b4e8.tar.bz2
Allow capturing command output of a custom target.
For commands that always output to stdout and don't have a "-o" or "--output" or some other similar option, this 'capture' setting allows the build to capture the result and place it in the output file.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index dd03d81..48d7843 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -927,6 +927,7 @@ class CustomTarget:
known_kwargs = {'input' : True,
'output' : True,
'command' : True,
+ 'capture' : False,
'install' : True,
'install_dir' : True,
'build_always' : True,
@@ -982,6 +983,10 @@ class CustomTarget:
raise InvalidArguments('Output argument not a string.')
if '/' in i:
raise InvalidArguments('Output must not contain a path segment.')
+ self.capture = kwargs.get('capture', False)
+ if self.capture and len(self.output) != 1:
+ raise InvalidArguments(
+ 'Capturing can only output to a single file.')
if 'command' not in kwargs:
raise InvalidArguments('Missing keyword argument "command".')
cmd = kwargs['command']