From 29905d4638608f8cb9bb4db4300d003c08063ffc Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 27 Jun 2008 23:42:29 +0000 Subject: 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 --- pym/_emerge/__init__.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'pym') 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(): -- cgit v1.2.3-1-g7c22