552 if depcube not in cubes and depcube in available: |
552 if depcube not in cubes and depcube in available: |
553 cubes.append(depcube) |
553 cubes.append(depcube) |
554 todo.append(depcube) |
554 todo.append(depcube) |
555 return cubes |
555 return cubes |
556 |
556 |
557 def reorder_cubes(self, cubes): |
557 @classmethod |
|
558 def reorder_cubes(cls, cubes): |
558 """reorder cubes from the top level cubes to inner dependencies |
559 """reorder cubes from the top level cubes to inner dependencies |
559 cubes |
560 cubes |
560 """ |
561 """ |
561 from logilab.common.graph import ordered_nodes, UnorderableGraph |
562 from logilab.common.graph import ordered_nodes, UnorderableGraph |
562 # See help string for 'ui-cube' in web/webconfig.py for the reasons |
|
563 # behind this hack. |
|
564 uicube = self.get('ui-cube', None) |
|
565 graph = {} |
563 graph = {} |
566 if uicube: |
|
567 graph[uicube] = set() |
|
568 for cube in cubes: |
564 for cube in cubes: |
569 cube = CW_MIGRATION_MAP.get(cube, cube) |
565 cube = CW_MIGRATION_MAP.get(cube, cube) |
570 graph[cube] = set(dep for dep in self.cube_dependencies(cube) |
566 graph[cube] = set(dep for dep in cls.cube_dependencies(cube) |
571 if dep in cubes) |
567 if dep in cubes) |
572 graph[cube] |= set(dep for dep in self.cube_recommends(cube) |
568 graph[cube] |= set(dep for dep in cls.cube_recommends(cube) |
573 if dep in cubes) |
569 if dep in cubes) |
574 if uicube and cube != uicube \ |
|
575 and cube not in self.cube_dependencies(uicube) \ |
|
576 and cube not in self.cube_recommends(uicube): |
|
577 graph[cube].add(uicube) |
|
578 try: |
570 try: |
579 return ordered_nodes(graph) |
571 return ordered_nodes(graph) |
580 except UnorderableGraph as ex: |
572 except UnorderableGraph as ex: |
581 raise ConfigurationError(ex) |
573 raise ConfigurationError(ex) |
582 |
574 |