aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-08-27 13:42:13 +0300
committerGitHub <noreply@github.com>2016-08-27 13:42:13 +0300
commit4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6 (patch)
treefd64a026c5c364ce296230ac40f68224318efbc7 /mesonbuild/build.py
parent3ed1ff1c714e35beb82d02a9f1a1bccb992329b2 (diff)
parentb7757189e4eb8a17182d07cdcad53e8f5ebad0ce (diff)
downloadmeson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.zip
meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.tar.gz
meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.tar.bz2
Merge pull request #712 from QuLogic/capturing-custom-target
Allow capturing command output of a custom target.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index dd03d81..ace4853 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']
@@ -1010,6 +1015,9 @@ class CustomTarget:
else:
raise InvalidArguments('Argument %s in "command" is invalid.' % i)
self.command = final_cmd
+ if self.capture and '@OUTPUT@' in self.command:
+ raise InvalidArguments(
+ '@OUTPUT@ is not allowed when capturing output.')
if 'install' in kwargs:
self.install = kwargs['install']
if not isinstance(self.install, bool):