From bb56b6ea575b796565962ec95741f71aa4d056d4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 18 Oct 2006 07:32:43 +0000 Subject: Add more dependency priority levels for merge order calculations. Previously, all installed deps were categorized at the same level with other soft deps. Now there are 3 priority levels for soft deps: satisfied buildtime, satisfied runtime, and other. svn path=/main/trunk/; revision=4745 --- pym/portage.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'pym') diff --git a/pym/portage.py b/pym/portage.py index aecbda293..4d6c86a04 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -312,10 +312,6 @@ def flatten(mytokens): #beautiful directed graph object class digraph: - NONE = -1 - SOFT = 0 - MEDIUM = 1 - HARD = 2 def __init__(self): """Create an empty digraph""" @@ -323,7 +319,7 @@ class digraph: self.nodes = {} self.order = [] - def add(self, node, parent, priority=2): + def add(self, node, parent, priority=0): """Adds the specified node with the specified parent. If the dep is a soft-dep and the node already has a hard @@ -376,9 +372,9 @@ class digraph: """Return a list of all nodes in the graph""" return self.order[:] - def child_nodes(self, node, ignore_priority=-1): + def child_nodes(self, node, ignore_priority=None): """Return all children of the specified node""" - if ignore_priority == -1: + if ignore_priority is None: return self.nodes[node][0].keys() children = [] for child, priority in self.nodes[node][0].iteritems(): @@ -390,7 +386,7 @@ class digraph: """Return all parents of the specified node""" return self.nodes[node][1].keys() - def leaf_nodes(self, ignore_priority=-1): + def leaf_nodes(self, ignore_priority=None): """Return all nodes that have no children If ignore_soft_deps is True, soft deps are not counted as @@ -407,7 +403,7 @@ class digraph: leaf_nodes.append(node) return leaf_nodes - def root_nodes(self, ignore_priority=-1): + def root_nodes(self, ignore_priority=None): """Return all nodes that have no parents. If ignore_soft_deps is True, soft deps are not counted as @@ -454,7 +450,7 @@ class digraph: return leaf_nodes[0] return None - def hasallzeros(self, ignore_priority=-1): + def hasallzeros(self, ignore_priority=None): return len(self.leaf_nodes(ignore_priority=ignore_priority)) == \ len(self.order) @@ -467,12 +463,7 @@ class digraph: print "(no children)" for child in self.nodes[node][0]: print " ",child, - if self.nodes[node][0][child] == self.HARD: - print "(hard)" - elif self.nodes[node][0][child] == self.MEDIUM: - print "(medium)" - else: - print "(soft)" + print "(%s)" % self.nodes[node][0][child] -- cgit v1.2.3-1-g7c22