Fix digraph.clone() to properly clone priority lists. (trunk r12587)
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:44:38 +0000 (03:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:44:38 +0000 (03:44 -0000)
svn path=/main/branches/2.1.6/; revision=12868

pym/portage/__init__.py

index 20fb6ba2fd79eee15b5f6dc14919d38c7cf7786b..0f27e2b39aaf869611888a21b9f5789340132eff 100644 (file)
@@ -561,8 +561,14 @@ class digraph(object):
        def clone(self):
                clone = digraph()
                clone.nodes = {}
-               for k, v in self.nodes.iteritems():
-                       clone.nodes[k] = (v[0].copy(), v[1].copy(), v[2])
+               for children, parents, node in self.nodes.itervalues():
+                       children_clone = {}
+                       for child, priorities in children.iteritems():
+                               children_clone[child] = priorities[:]
+                       parents_clone = {}
+                       for parent, priorities in parents.iteritems():
+                               parents_clone[parent] = priorities[:]
+                       clone.nodes[node] = (children_clone, parents_clone, node)
                clone.order = self.order[:]
                return clone