本文整理汇总了Python中package.Package.verCMP方法的典型用法代码示例。如果您正苦于以下问题:Python Package.verCMP方法的具体用法?Python Package.verCMP怎么用?Python Package.verCMP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类package.Package
的用法示例。
在下文中一共展示了Package.verCMP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _do_newest_filtering
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import verCMP [as 别名]
def _do_newest_filtering(filelist):
'''
Only return the newest package for each name.arch
'''
newest = {}
for f in filelist:
pkg = Package(f)
key = (pkg.name, pkg.arch)
if key in newest:
# the current package is older
if pkg.verCMP(newest[key]) < 0:
continue
# the current package is the same version
if pkg.verCMP(newest[key]) == 0:
continue
# the current package is newer than what we have stored
del newest[key]
newest[key] = pkg
# get back the file list
filelist_new = []
for pkg in newest.values():
filelist_new.append(pkg.filename)
return filelist_new