summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-05-02 08:04:17 +0000
committerZac Medico <zmedico@gentoo.org>2009-05-02 08:04:17 +0000
commitc28ead86e988d048e13c2080e79387c95a7be9e3 (patch)
treeb5b8d9110139a823878a194d6d2b9e4eea4c99ca
parente118fc3c3c1c4a3994289aad86821e8104838507 (diff)
downloadportage-c28ead86e988d048e13c2080e79387c95a7be9e3.tar.gz
portage-c28ead86e988d048e13c2080e79387c95a7be9e3.tar.bz2
portage-c28ead86e988d048e13c2080e79387c95a7be9e3.zip
Fix DepPriority.__int__() to return distinguishable values, for use when
measuring hardness for the circular dependency display. This fixes a problem visible in bug #268038, comment #0, where buildtime dependencies are incorrectly displayed as runtime dependencies. svn path=/main/trunk/; revision=13589
-rw-r--r--pym/_emerge/__init__.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index fc58198f6..baa4ef267 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -936,6 +936,43 @@ class DepPriority(AbstractDepPriority):
__slots__ = ("satisfied", "optional", "rebuild")
def __int__(self):
+ """
+ Note: These priorities are only used for measuring hardness
+ in the circular dependency display via digraph.debug_print(),
+ and nothing more. For actual merge order calculations, the
+ measures defined by the DepPriorityNormalRange and
+ DepPrioritySatisfiedRange classes are used.
+
+ Attributes Hardness
+
+ not satisfied and buildtime 8
+ not satisfied and runtime 7
+ not satisfied and runtime_post 6
+ satisfied and buildtime and rebuild 5
+ satisfied and buildtime 4
+ satisfied and runtime 3
+ satisfied and runtime_post 2
+ optional 1
+ (none of the above) 0
+
+ """
+ if not self.satisfied:
+ if self.buildtime:
+ return 8
+ if self.runtime:
+ return 7
+ if self.runtime_post:
+ return 6
+ if self.buildtime:
+ if self.rebuild:
+ return 5
+ return 4
+ if self.runtime:
+ return 3
+ if self.runtime_post:
+ return 2
+ if self.optional:
+ return 1
return 0
def __str__(self):