import sys
from apt.debfile import DebPackage
deb = DebPackage(sys.argv[1])
print(deb.required_changes)
我希望上面的代码能够显示应该满足给定deb文件的依赖关系的包,但是我得到tuple的空lists:
([], [], [])
我确保检查一个我知道肯定已经卸载了依赖项的软件包。
答案 0 :(得分:2)
我不得不致电deb.check()
以激活dep.required_changes
等的返回值。还必须传递apt.cache.Cache
的实例,否则会抱怨:
import sys
from apt.cache import Cache
from apt.debfile import DebPackage
cache = Cache()
deb = DebPackage(sys.argv[1], cache)
deb.check()
print(deb.missing_deps)
print(deb.required_changes)
输出:
% python apt_info.py ./libzeroc-ice33_3.3.1-12_amd64.deb
['libiceutil33']
(['libiceutil33'], [], [])