本文整理汇总了Python中ubuntutweak.common.package.PACKAGE_WORKER.get_downgradeable_pkgs方法的典型用法代码示例。如果您正苦于以下问题:Python PACKAGE_WORKER.get_downgradeable_pkgs方法的具体用法?Python PACKAGE_WORKER.get_downgradeable_pkgs怎么用?Python PACKAGE_WORKER.get_downgradeable_pkgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubuntutweak.common.package.PACKAGE_WORKER
的用法示例。
在下文中一共展示了PACKAGE_WORKER.get_downgradeable_pkgs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_model
# 需要导入模块: from ubuntutweak.common.package import PACKAGE_WORKER [as 别名]
# 或者: from ubuntutweak.common.package.PACKAGE_WORKER import get_downgradeable_pkgs [as 别名]
def update_model(self, ppas):
model = self.get_model()
model.clear()
pkg_dict = {}
for ppa in ppas:
path = get_ppa_list_name(ppa)
log.debug('Find the PPA path name: %s', path)
if path:
for line in open(path):
if line.startswith('Package:'):
pkg = line.split()[1].strip()
if pkg in pkg_dict:
# Join another ppa info to the pkg dict, so that
# later we can know if more than two ppa provide
# the pkg
pkg_dict[pkg].extend([ppa])
else:
pkg_dict[pkg] = [ppa]
pkg_map = PACKAGE_WORKER.get_downgradeable_pkgs(pkg_dict)
if pkg_map:
log.debug("Start insert pkg_map to model: %s\n" % str(pkg_map))
for pkg, (p_verion, s_verion) in pkg_map.items():
model.append((pkg, p_verion, s_verion))