summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-27 23:42:29 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-27 23:42:29 +0000
commit29905d4638608f8cb9bb4db4300d003c08063ffc (patch)
treed831f6654627b6c6932ff8f0e500d3a19b449786
parentb271433d653888f140fe8513e2e1171fbeba247c (diff)
downloadportage-29905d4638608f8cb9bb4db4300d003c08063ffc.tar.gz
portage-29905d4638608f8cb9bb4db4300d003c08063ffc.tar.bz2
portage-29905d4638608f8cb9bb4db4300d003c08063ffc.zip
Fix depgraph.break_refs() to work with DependencyArg instances (or anything
else that may have a "root_config" attribute). svn path=/main/trunk/; revision=10823
-rw-r--r--pym/_emerge/__init__.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index cc7ed5b95..c5268a6e6 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -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():