Fix some typos.
[portage.git] / pym / _emerge / UnmergeDepPriority.py
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 from _emerge.AbstractDepPriority import AbstractDepPriority
5 class UnmergeDepPriority(AbstractDepPriority):
6         __slots__ = ("ignored", "optional", "satisfied",)
7         """
8         Combination of properties           Priority  Category
9
10         runtime_slot_op                        0       HARD
11         runtime                               -1       HARD
12         runtime_post                          -2       HARD
13         buildtime                             -3       SOFT
14         (none of the above)                   -3       SOFT
15         """
16
17         MAX    =  0
18         SOFT   = -3
19         MIN    = -3
20
21         def __init__(self, **kwargs):
22                 AbstractDepPriority.__init__(self, **kwargs)
23                 if self.buildtime:
24                         self.optional = True
25
26         def __int__(self):
27                 if self.runtime_slot_op:
28                         return 0
29                 if self.runtime:
30                         return -1
31                 if self.runtime_post:
32                         return -2
33                 if self.buildtime:
34                         return -3
35                 return -3
36
37         def __str__(self):
38                 if self.ignored:
39                         return "ignored"
40                 if self.runtime_slot_op:
41                         return "hard slot op"
42                 myvalue = self.__int__()
43                 if myvalue > self.SOFT:
44                         return "hard"
45                 return "soft"
46