Fix depgraph.break_refs() to work with DependencyArg instances (or anything
authorZac Medico <zmedico@gentoo.org>
Fri, 27 Jun 2008 23:42:29 +0000 (23:42 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 27 Jun 2008 23:42:29 +0000 (23:42 -0000)
else that may have a "root_config" attribute).

svn path=/main/trunk/; revision=10823

pym/_emerge/__init__.py

index cc7ed5b95b14b9adda8724631840dd53a5b2d19b..c5268a6e6680e059c1271afe13a6e195ba72e3dc 100644 (file)
@@ -3862,25 +3862,23 @@ class depgraph(object):
                        retlist.reverse()
                return retlist
 
-       def break_refs(self, mergelist):
+       def break_refs(self, nodes):
                """
                Take a mergelist like that returned from self.altlist() and
                break any references that lead back to the depgraph. This is
                useful if you want to hold references to packages without
                also holding the depgraph on the heap.
                """
-               for node in mergelist:
-                       if not isinstance(node, Package):
-                               continue
-
-                       # The FakeVartree references the _package_cache which
-                       # references the depgraph. So that Package instances don't
-                       # hold the depgraph and FakeVartree on the heap, replace
-                       # the RootConfig that references the FakeVartree with the
-                       # original RootConfig instance which references the actual
-                       # vartree.
-                       node.root_config = \
-                               self._trees_orig[node.root]["root_config"]
+               for node in nodes:
+                       if hasattr(node, "root_config"):
+                               # The FakeVartree references the _package_cache which
+                               # references the depgraph. So that Package instances don't
+                               # hold the depgraph and FakeVartree on the heap, replace
+                               # the RootConfig that references the FakeVartree with the
+                               # original RootConfig instance which references the actual
+                               # vartree.
+                               node.root_config = \
+                                       self._trees_orig[node.root_config.root]["root_config"]
 
        def _resolve_conflicts(self):
                if not self._complete_graph():