aboutsummaryrefslogtreecommitdiff
blob: ec79bb3d5f7b113c5c1e195d9a6f4dbbd45c0337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

from _emerge.AbstractDepPriority import AbstractDepPriority
class DepPriority(AbstractDepPriority):

	__slots__ = ("satisfied", "optional", "ignored")

	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

		buildtime_slot_op                       0
		buildtime                              -1
		runtime                                -2
		runtime_post                           -3
		optional                               -4
		(none of the above)                    -5

		"""

		if self.optional:
			return -4
		if self.buildtime_slot_op:
			return 0
		if self.buildtime:
			return -1
		if self.runtime:
			return -2
		if self.runtime_post:
			return -3
		return -5

	def __str__(self):
		if self.ignored:
			return "ignored"
		if self.optional:
			return "optional"
		if self.buildtime_slot_op:
			return "buildtime_slot_op"
		if self.buildtime:
			return "buildtime"
		if self.runtime_slot_op:
			return "runtime_slot_op"
		if self.runtime:
			return "runtime"
		if self.runtime_post:
			return "runtime_post"
		return "soft"