From d7a49d2705ee9ce532e8fd30c897695052b9c053 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 3 Oct 2006 06:45:58 +0000 Subject: [PATCH] Refector depgraph.altlist() reverse/ignore_priority handling. svn path=/main/trunk/; revision=4578 --- bin/emerge | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/bin/emerge b/bin/emerge index a232744cd..c543913b2 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1255,25 +1255,15 @@ class depgraph: def altlist(self, reversed=False): mygraph=self.digraph.copy() retlist=[] + if reversed: + get_nodes = mygraph.root_nodes + else: + get_nodes = mygraph.leaf_nodes while not mygraph.empty(): - ignore_priority = -1 - if reversed: - nodes = mygraph.root_nodes() - if not nodes: - ignore_priority = digraph.SOFT - nodes = mygraph.root_nodes(ignore_priority=digraph.SOFT) - if not nodes: - ignore_priority = digraph.MEDIUM - nodes = mygraph.root_nodes(ignore_priority=digraph.MEDIUM) - else: - nodes = mygraph.leaf_nodes() - if not nodes: - ignore_priority = digraph.SOFT - nodes = mygraph.leaf_nodes(ignore_priority=digraph.SOFT) - if not nodes: - ignore_priority = digraph.MEDIUM - nodes = mygraph.leaf_nodes(ignore_priority=digraph.MEDIUM) - + for ignore_priority in (-1, digraph.SOFT, digraph.MEDIUM): + nodes = get_nodes(ignore_priority=ignore_priority) + if nodes: + break selected_nodes = None if nodes: if ignore_priority <= digraph.SOFT: -- 2.26.2