1
import sys
from apt.debfile import DebPackage
deb = DebPackage(sys.argv[1])
print(deb.required_changes)

我希望上面的代码能够显示应该满足给定 deb 文件依赖关系的包,但是我得到了一个空列表的元组

([], [], [])

我确保检查我确定已卸载依赖项的包。

4

1 回答 1

2

我不得不打电话deb.check()来激发它返回值dep.required_changes等。还必须向它传递一个apt.cache.Cache它抱怨的 else 实例:

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'], [], [])
于 2011-04-27T00:16:45.347 回答