diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-12 21:19:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-12 21:19:21 +0100 |
| commit | ab5f3e1d11f0fb84aa375e29d9de344b940bb74b (patch) | |
| tree | 4ffd60421dd24265746d6929556c66b1deba6f49 | |
| parent | 3f7f25bd84621bc93edb80eb4d4aff26ff8fa951 (diff) | |
Allow projects to pass options into their dependencies.
| -rwxr-xr-x | cdist | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -211,11 +211,30 @@ class Target(object): dep = Project(d[0], '.', d[1]) dep.checkout(self) self.build_dependencies(dep) - self.build(dep) + + # Make the options to pass in from the option_defaults of the thing + # we are building and any options specified by the parent. + # The presence of option_defaults() is taken to mean that this + # cscript understands and expects options + options = {} + if 'option_defaults' in dep.cscript: + options = dep.cscript['option_defaults']() + if len(d) > 2: + for k, v in d[2].iteritems(): + options[k] = v + + self.build(dep, options) + else: + # Backwards compatibility + self.build(dep) + os.chdir(cwd) - def build(self, project): - project.cscript['build'](self) + def build(self, project, options=None): + if options is not None: + project.cscript['build'](self, options) + else: + project.cscript['build'](self) def package(self, project): project.checkout(self) |
