From 1ae7b74de996df5c1090f63864fb4646506948b5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 2 Nov 2007 02:14:48 +0000 Subject: Collapse 2 identical code hunks into 1. svn path=/main/trunk/; revision=8359 --- pym/_emerge/__init__.py | 55 ++++++++++++++++--------------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 6d3e69215..d47739438 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2729,6 +2729,7 @@ class depgraph(object): while not mygraph.empty(): selected_nodes = None + ignore_priority = None if prefer_asap and asap_nodes: """ASAP nodes are merged before their soft deps.""" asap_nodes = [node for node in asap_nodes \ @@ -2766,24 +2767,6 @@ class depgraph(object): # settle for a root node selected_nodes = [nodes[0]] - if selected_nodes and ignore_priority > DepPriority.SOFT: - # Try to merge ignored medium deps as soon as possible. - for node in selected_nodes: - children = set(mygraph.child_nodes(node)) - soft = children.difference( - mygraph.child_nodes(node, - ignore_priority=DepPriority.SOFT)) - medium_soft = children.difference( - mygraph.child_nodes(node, - ignore_priority=DepPriority.MEDIUM_SOFT)) - medium_soft.difference_update(soft) - for child in medium_soft: - if child in selected_nodes: - continue - if child in asap_nodes: - continue - asap_nodes.append(child) - if not selected_nodes: nodes = get_nodes(ignore_priority=DepPriority.MEDIUM) if nodes: @@ -2839,25 +2822,23 @@ class depgraph(object): accept_root_node = True continue - if selected_nodes and ignore_priority > DepPriority.SOFT: - # Try to merge ignored medium deps as soon as possible. - for node in selected_nodes: - children = set(mygraph.child_nodes(node)) - soft = children.difference( - mygraph.child_nodes(node, - ignore_priority=DepPriority.SOFT)) - medium_soft = children.difference( - mygraph.child_nodes(node, - ignore_priority=DepPriority.MEDIUM_SOFT)) - medium_soft.difference_update(soft) - for child in medium_soft: - if child in selected_nodes: - continue - if child in asap_nodes: - continue - # TODO: Try harder to make these nodes get - # merged absolutely as soon as possible. - asap_nodes.append(child) + if selected_nodes and ignore_priority > DepPriority.SOFT: + # Try to merge ignored medium deps as soon as possible. + for node in selected_nodes: + children = set(mygraph.child_nodes(node)) + soft = children.difference( + mygraph.child_nodes(node, + ignore_priority=DepPriority.SOFT)) + medium_soft = children.difference( + mygraph.child_nodes(node, + ignore_priority=DepPriority.MEDIUM_SOFT)) + medium_soft.difference_update(soft) + for child in medium_soft: + if child in selected_nodes: + continue + if child in asap_nodes: + continue + asap_nodes.append(child) if not selected_nodes: if not myblockers.is_empty(): -- cgit v1.2.3-1-g7c22