blob: 86395549ffee612599bc0fbcc4e963612e139260 (
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
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.DepPriority import DepPriority
class DepPriorityNormalRange(object):
"""
DepPriority properties Index Category
buildtime HARD
runtime 3 MEDIUM
runtime_post 2 MEDIUM_SOFT
optional 1 SOFT
(none of the above) 0 NONE
"""
MEDIUM = 3
MEDIUM_SOFT = 2
SOFT = 1
NONE = 0
@classmethod
def _ignore_optional(cls, priority):
if priority.__class__ is not DepPriority:
return False
return bool(priority.optional)
@classmethod
def _ignore_runtime_post(cls, priority):
if priority.__class__ is not DepPriority:
return False
return bool(priority.optional or priority.runtime_post)
@classmethod
def _ignore_runtime(cls, priority):
if priority.__class__ is not DepPriority:
return False
return bool(priority.optional or not priority.buildtime)
ignore_medium = _ignore_runtime
ignore_medium_soft = _ignore_runtime_post
ignore_soft = _ignore_optional
DepPriorityNormalRange.ignore_priority = (
None,
DepPriorityNormalRange._ignore_optional,
DepPriorityNormalRange._ignore_runtime_post,
DepPriorityNormalRange._ignore_runtime
)
|