summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-09-12 21:19:21 +0100
committerCarl Hetherington <cth@carlh.net>2013-09-12 21:19:21 +0100
commitab5f3e1d11f0fb84aa375e29d9de344b940bb74b (patch)
tree4ffd60421dd24265746d6929556c66b1deba6f49
parent3f7f25bd84621bc93edb80eb4d4aff26ff8fa951 (diff)
Allow projects to pass options into their dependencies.
-rwxr-xr-xcdist25
1 files changed, 22 insertions, 3 deletions
diff --git a/cdist b/cdist
index 5be43e2..754ec0a 100755
--- a/cdist
+++ b/cdist
@@ -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)