def PackagesetToBestByRepo(packages): state_by_repo = {} for package in PackagesetSortByVersion(packages): if package.repo not in state_by_repo or ( VersionClass.IsIgnored( state_by_repo[package.repo].versionclass) and not VersionClass.IsIgnored(package.versionclass)): state_by_repo[package.repo] = package return state_by_repo
def packageset_to_best_by_repo(packages): state_by_repo = {} for package in packageset_sort_by_version(packages): if package.repo not in state_by_repo or (VersionClass.IsIgnored(state_by_repo[package.repo].versionclass) and not VersionClass.IsIgnored(package.versionclass)): state_by_repo[package.repo] = package return state_by_repo