From: Zac Medico Date: Tue, 3 Oct 2006 06:45:58 +0000 (-0000) Subject: Refector depgraph.altlist() reverse/ignore_priority handling. X-Git-Tag: v2.1.2~726 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d7a49d2705ee9ce532e8fd30c897695052b9c053;p=portage.git Refector depgraph.altlist() reverse/ignore_priority handling. svn path=/main/trunk/; revision=4578 --- 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: