[cig-commits] commit: Adding a better way of choosing a set of

Mercurial hg at geodynamics.org
Mon Nov 24 11:27:49 PST 2008


changeset:   7:065ffcafa66d
user:        LukeHodkinson
date:        Wed Jun 25 03:22:43 2008 +0000
files:       SConfig/Configuration.py SConfig/Project.py
description:
Adding a better way of choosing a set of
packages to use.


diff -r 6d19af17c83f -r 065ffcafa66d SConfig/Configuration.py
--- a/SConfig/Configuration.py	Wed Jun 25 03:09:08 2008 +0000
+++ b/SConfig/Configuration.py	Wed Jun 25 03:22:43 2008 +0000
@@ -91,6 +91,16 @@ class Configuration:
                 return None
             deps += result
 
+    def value(self):
+        """Evaluates a 'value' figure for this configuration. The value
+        corresponds to how it should be weighted when considering which
+        configuration to use. Includes the values of it's children."""
+
+        val = len(self.deps)
+        for d in self.deps:
+            val += d.value()
+        return val
+
     def __str__(self, brief=True):
         """Convert to printable string."""
 
diff -r 6d19af17c83f -r 065ffcafa66d SConfig/Project.py
--- a/SConfig/Project.py	Wed Jun 25 03:09:08 2008 +0000
+++ b/SConfig/Project.py	Wed Jun 25 03:22:43 2008 +0000
@@ -78,11 +78,16 @@ class Project(SConfig.Node):
                         self.ctx.Display('      %s\n' % useable.inst.base_dir)
             return False
 
-        # Decide which selection of dependencies to use. For the moment base
-        # it entirely on the number of packages in the set.
-        selected = []
+        # Decide which selection of dependencies to use. We use the 'value'
+        # method for each configuration.
+        max_val = 0
+        selected = None
         for d in deps:
-            if len(d) > len(selected):
+            cur_val = 0
+            for cfg in d:
+                cur_val += cfg.value()
+            if cur_val > max_val:
+                max_val = cur_val
                 selected = d
 
         # Set the 'selected' member of each package with configurations.



More information about the CIG-COMMITS mailing list