blob: e01c1ff7537761ff2a09b9172b5a20a5779c3ac8 (
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
|
#!/usr/bin/env python3
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import sys
import subprocess
pkts = []
for arg in sys.argv[1:]:
proc = subprocess.Popen(["dpkg-deb",
"--info",
arg],
stdin=None,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = proc.stdout.read()
err = proc.stderr.read()
if err:
print("An error occurred with {} ({})".format(arg, err))
continue
for line in out.splitlines():
line = line.decode('utf-8')
if " Depends:" in line:
line = line.replace(" Depends:", "")
for _dep in line.split(','):
pkts.append(_dep.split()[0])
print(" ".join(pkts))
|