diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-08-24 04:35:15 -0400 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-08-26 20:46:42 -0400 |
commit | 70d94a555004563178878b73274e345adff5b4e8 (patch) | |
tree | a5944eecebc2992e322e42364148d63ba73acda8 /mesonbuild/build.py | |
parent | dcaf2d7b3d010526eb5035fec788f1b9a854262c (diff) | |
download | meson-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.py | 5 |
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'] |