blob: cb0e6c26b1550615264c91ef525dbede09c64c03 (
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
56
57
58
59
|
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from _emerge.DepPriority import DepPriority
class DepPriorityNormalRange:
"""
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
MEDIUM_POST = 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
# If we ever allow "optional" runtime_slot_op, we'll need
# to adjust this appropriately. But only build time dependencies
# are optional right now, so it's not an issue as-is.
return bool(
not (priority.runtime_slot_op and not priority.cross)
and (priority.optional or not priority.buildtime)
)
ignore_medium = _ignore_runtime
ignore_medium_soft = _ignore_runtime_post
ignore_medium_post = _ignore_runtime_post
ignore_soft = _ignore_optional
DepPriorityNormalRange.ignore_priority = (
None,
DepPriorityNormalRange._ignore_optional,
DepPriorityNormalRange._ignore_runtime_post,
DepPriorityNormalRange._ignore_runtime,
)
|