cwconfig.py
branchstable
changeset 9013 b4bcabf55e77
parent 8850 4032499c701e
child 9251 e4d753c8b1c4
--- a/cwconfig.py	Fri Jun 14 16:13:24 2013 +0200
+++ b/cwconfig.py	Fri Jun 14 16:26:25 2013 +0200
@@ -565,19 +565,27 @@
                         todo.append(depcube)
         return cubes
 
-    @classmethod
-    def reorder_cubes(cls, cubes):
+    def reorder_cubes(self, cubes):
         """reorder cubes from the top level cubes to inner dependencies
         cubes
         """
         from logilab.common.graph import ordered_nodes, UnorderableGraph
+        # See help string for 'ui-cube' in web/webconfig.py for the reasons
+        # behind this hack.
+        uicube = self.get('ui-cube', None)
         graph = {}
+        if uicube:
+            graph[uicube] = set()
         for cube in cubes:
             cube = CW_MIGRATION_MAP.get(cube, cube)
-            graph[cube] = set(dep for dep in cls.cube_dependencies(cube)
+            graph[cube] = set(dep for dep in self.cube_dependencies(cube)
                               if dep in cubes)
-            graph[cube] |= set(dep for dep in cls.cube_recommends(cube)
+            graph[cube] |= set(dep for dep in self.cube_recommends(cube)
                                if dep in cubes)
+            if uicube and cube != uicube \
+                    and cube not in self.cube_dependencies(uicube) \
+                    and cube not in self.cube_recommends(uicube):
+                graph[cube].add(uicube)
         try:
             return ordered_nodes(graph)
         except UnorderableGraph as ex: