[config] expand_cubes(with_recommends=True) shouldn't return recommened-but-not-installed cubes
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 07 Jul 2010 12:09:29 +0200
changeset 5917 64198285352e
parent 5916 36206e846a27
child 5918 88c2f74e9ee8
[config] expand_cubes(with_recommends=True) shouldn't return recommened-but-not-installed cubes
cwconfig.py
--- a/cwconfig.py	Wed Jul 07 12:08:10 2010 +0200
+++ b/cwconfig.py	Wed Jul 07 12:09:29 2010 +0200
@@ -497,6 +497,13 @@
             deps = dict((key, None) for key in deps)
             warn('[3.8] cube %s should define %s as a dict' % (cube, key),
                  DeprecationWarning)
+        for depcube in deps:
+            try:
+                newname = CW_MIGRATION_MAP[depcube]
+            except KeyError:
+                pass
+            else:
+                deps[newname] = deps.pop(depcube)
         return deps
 
     @classmethod
@@ -516,17 +523,17 @@
         """
         cubes = list(cubes)
         todo = cubes[:]
+        if with_recommends:
+            available = set(cls.available_cubes())
         while todo:
             cube = todo.pop(0)
             for depcube in cls.cube_dependencies(cube):
                 if depcube not in cubes:
-                    depcube = CW_MIGRATION_MAP.get(depcube, depcube)
                     cubes.append(depcube)
                     todo.append(depcube)
             if with_recommends:
                 for depcube in cls.cube_recommends(cube):
-                    if depcube not in cubes:
-                        depcube = CW_MIGRATION_MAP.get(depcube, depcube)
+                    if depcube not in cubes and depcube in available:
                         cubes.append(depcube)
                         todo.append(depcube)
         return cubes