blob: 5ae04ce0326424084f467a922af1e35ce3ad32cc (
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
|
try:
import portage
except ImportError:
from os import path as osp
import sys
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
def visible(pkgsettings, pkg):
"""
Check if a package is visible. This can raise an InvalidDependString
exception if LICENSE is invalid.
TODO: optionally generate a list of masking reasons
@rtype: Boolean
@returns: True if the package is visible, False otherwise.
"""
if not pkg.metadata["SLOT"]:
return False
if not pkg.installed:
if not pkgsettings._accept_chost(pkg.cpv, pkg.metadata):
return False
eapi = pkg.metadata["EAPI"]
if not portage.eapi_is_supported(eapi):
return False
if not pkg.installed:
if portage._eapi_is_deprecated(eapi):
return False
if pkgsettings._getMissingKeywords(pkg.cpv, pkg.metadata):
return False
if pkgsettings._getMaskAtom(pkg.cpv, pkg.metadata):
return False
if pkgsettings._getProfileMaskAtom(pkg.cpv, pkg.metadata):
return False
try:
if pkgsettings._getMissingLicenses(pkg.cpv, pkg.metadata):
return False
except portage.exception.InvalidDependString:
return False
return True
|