Try to tidy build/build_dependencies stuff.
authorCarl Hetherington <cth@carlh.net>
Tue, 8 Dec 2015 23:54:44 +0000 (23:54 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 8 Dec 2015 23:54:44 +0000 (23:54 +0000)
TODO
cdist/cmd_build.py
cdist/target.py
cdist/tree.py

diff --git a/TODO b/TODO
index 75b5aa2ee48894f4711898d045f9b87afcfb3d8f..ab6656abe70c39fde8dbaf31e5251075ed0b4f70 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,2 @@
 remove need for os.path.abspath in cscripts? not all that easy?
-tidy build/build_dependencies stuff
 common stuff for commands which call a method to get some files? doesn't look like it
\ No newline at end of file
index 200b8e4a9eab0f79b5bf362789be9949fc5d9012..e01ccaba3017f60a928bb9d2ee343b143df5ffa9 100644 (file)
@@ -30,7 +30,6 @@ class CmdBuild(object):
 
         target = target_factory(args.target, args.debug, args.work)
         tree = globals.trees.get(args.project, args.checkout, target)
-        tree.build_dependencies()
         tree.build()
         if not args.keep:
             target.cleanup()
index 07d58544fd243ec9e9e6128dc60df66c9f07a839..b4f7727b60adf9f6a7f48f07bb3219a56a5e2303 100644 (file)
@@ -45,12 +45,10 @@ class Target(object):
 
     def package(self, project, checkout):
         tree = globals.trees.get(project, checkout, self)
-        tree.build_dependencies()
-        tree.build(tree)
+        tree.build()
         return tree.call('package', tree.version), tree.git_commit
 
     def test(self, tree):
-        tree.build_dependencies()
         tree.build()
         return tree.call('test')
 
@@ -217,7 +215,6 @@ class OSXUniversalTarget(OSXTarget):
         for b in [32, 64]:
             target = OSXSingleTarget(b, os.path.join(self.directory, '%d' % b))
             tree = globals.trees.get(project, checkout, target)
-            tree.build_dependencies()
             tree.build()
 
         tree = globals.trees.get(project, checkout, self)
index 11bc4dc9ea40806bfe6bbeef163a30bd198a0a11..7db84b2162e6c1e6164e56d147e85360ef192589 100644 (file)
@@ -79,25 +79,23 @@ class Tree(object):
         with TreeDirectory(self):
             return self.cscript[function](self.target, *args)
 
-    def build_dependencies(self):
+    def build(self, options={}):
         if 'dependencies' in self.cscript:
             for d in self.cscript['dependencies'](self.target):
                 log('Building dependency %s %s of %s' % (d[0], d[1], self.name))
                 dep = globals.trees.get(d[0], d[1], self.target)
-                dep.build_dependencies()
 
                 # Make the options to pass in from the option_defaults of the thing
                 # we are building and any options specified by the parent.
-                options = {}
+                dep_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
+                    dep_options = dep.cscript['option_defaults']()
+                if len(d) > 2:
+                    for k, v in d[2].iteritems():
+                        dep_options[k] = v
 
-                dep.build(options)
+                dep.build(dep_options)
 
-    def build(self, options=None):
         if self.built:
             return