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