blob: 8383463e88c557f056d0abe70c76c43d1f1b9430 (
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
|
import portage, sys
def format_depend(dep_list):
for item in list(dep_list):
if "||" in item: dep_list.remove(item)
if "?" in item: dep_list.remove(item)
index = 0
for item in list(dep_list):
dep_list[index] = item.split('[')[0]
dep_list[index] = portage.dep.dep_getcpv(item)
index += 1
index = 0
for item in list(dep_list):
if portage.getCPFromCPV(item):
dep_list[index] = portage.getCPFromCPV(item)
index += 1
return dep_list
def join_depend(f_depend, f_rdepend, f_pdepend):
return ' '.join(sorted(list(set(f_depend + f_rdepend + f_pdepend))))
cpv = sys.argv[1]
depend, rdepend, pdepend = portage.portdb.aux_get(cpv, ['DEPEND', 'RDEPEND', 'PDEPEND'])
depend = portage.dep.flatten(portage.dep.paren_reduce(depend, 1))
rdepend = portage.dep.flatten(portage.dep.paren_reduce(rdepend, 1))
pdepend = portage.dep.flatten(portage.dep.paren_reduce(pdepend, 1))
all_depend = join_depend(format_depend(depend), format_depend(rdepend), format_depend(pdepend))
print (all_depend)
|