diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-07-03 10:31:59 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-07-03 10:31:59 +0100 |
| commit | 052afcf2deea9cd24dade4d144638a549e494cf2 (patch) | |
| tree | dcd0411d0addc7d17951bda1819779fb2504ad0c | |
| parent | 1535cc3cc368d9ecfe97243c4874ae8e8b845045 (diff) | |
Maybe fix options with dependencies.
| -rwxr-xr-x | cdist | 50 |
1 files changed, 31 insertions, 19 deletions
@@ -701,25 +701,37 @@ class Tree(object): with TreeDirectory(self): return self.cscript[function](self.target, *args) - def build_dependencies(self, dry_run): - if 'dependencies' in self.cscript: - for d in self.call('dependencies'): - log('Building dependency %s %s of %s' % (d[0], d[1], self.name)) - dep = globals.trees.get(d[0], d[1], self.target) - - options = dict() - # Make the options to pass in from the option_defaults of the thing - # we are building and any options specified by the parent. - if 'option_defaults' in dep.cscript: - for k, v in dep.cscript['option_defaults']().items(): - options[k] = v - - if len(d) > 2: - for k, v in d[2].items(): - options[k] = v - - dep.build_dependencies(dry_run, options) - dep.build(dry_run, options) + def build_dependencies(self, dry_run, options=None): + + if not 'dependencies' in self.cscript: + return + + if len(inspect.getargspec(self.cscript['dependencies']).args) == 2: + deps = self.call('dependencies', options) + else: + deps = self.call('dependencies') + + for d in deps: + dep = globals.trees.get(d[0], d[1], self.target) + + options = dict() + # Make the options to pass in from the option_defaults of the thing + # we are building and any options specified by the parent. + if 'option_defaults' in dep.cscript: + for k, v in dep.cscript['option_defaults']().items(): + options[k] = v + + if len(d) > 2: + for k, v in d[2].items(): + options[k] = v + + msg = 'Building dependency %s %s of %s' % (d[0], d[1], self.name) + if len(options) > 0: + msg += ' with options %s' % options + log(msg) + + dep.build_dependencies(dry_run, options) + dep.build(dry_run, options) def build(self, dry_run, options=None): if self.built: |
