diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-10-18 07:32:43 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-10-18 07:32:43 +0000 |
commit | bb56b6ea575b796565962ec95741f71aa4d056d4 (patch) | |
tree | cf04f8ffe48d2132428e0f4f05b966e0f337c8ab /pym | |
parent | 34141d590023be7736105f9c7899f17d7d9e79d8 (diff) | |
download | portage-bb56b6ea575b796565962ec95741f71aa4d056d4.tar.gz portage-bb56b6ea575b796565962ec95741f71aa4d056d4.tar.bz2 portage-bb56b6ea575b796565962ec95741f71aa4d056d4.zip |
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
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 23 |
1 files changed, 7 insertions, 16 deletions
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] |