aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
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):