diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-07-27 02:54:23 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-07-27 02:54:23 +0300 |
commit | bae850775328650c3fc326221a97cf74ea3f04c3 (patch) | |
tree | 1d98131f07a2a0d86a98a14f24ca4b59bf5c0542 /build.py | |
parent | 5736f8dc60b1f54aeb39a140fc605711f5d4e544 (diff) | |
download | meson-bae850775328650c3fc326221a97cf74ea3f04c3.zip meson-bae850775328650c3fc326221a97cf74ea3f04c3.tar.gz meson-bae850775328650c3fc326221a97cf74ea3f04c3.tar.bz2 |
Make it possible to generate source files in custom targets.
Diffstat (limited to 'build.py')
-rw-r--r-- | build.py | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -159,9 +159,11 @@ class BuildTarget(): # Holder unpacking. Ugly. if hasattr(s, 'glist'): s = s.glist + if hasattr(s, 'held_object'): + s = s.held_object if isinstance(s, str): self.sources.append(s) - elif isinstance(s, GeneratedList): + elif isinstance(s, GeneratedList) or isinstance(s, CustomTarget): self.generated.append(s) else: raise InvalidArguments('Bad source in target %s.' % self.name) @@ -609,10 +611,13 @@ class CustomTarget: if 'output' not in kwargs: raise InvalidArguments('Missing keyword argument "output".') self.output = kwargs['output'] - if not(isinstance(self.output, str)): - raise InvalidArguments('Output argument not a string.') - if '/' in self.output: - raise InvalidArguments('Output must not contain a path segment.') + if not isinstance(self.output, list): + self.output = [self.output] + for i in self.output: + if not(isinstance(i, str)): + raise InvalidArguments('Output argument not a string.') + if '/' in i: + raise InvalidArguments('Output must not contain a path segment.') if 'command' not in kwargs: raise InvalidArguments('Missing keyword argument "command".') cmd = kwargs['command'] |