def package(self): '''Try and return a relevant single package object representing this group. Start by seeing if there is only one package, then look for the matching package by name, finally falling back to a standin package object.''' if len(self.packages) == 1: return self.packages[0] same_pkgs = [p for p in self.packages if p.pkgname == p.pkgbase] if same_pkgs: return same_pkgs[0] return PackageStandin(self.packages[0])
def package_links(self): '''Returns either actual packages or package-standins for virtual pkgbase packages.''' if self.packages: # we have real packages- just yield each in sequence for package in self.packages: yield package else: # fake out the template- this is slightly hacky but yields one # 'package-like' object per arch which is what the normal loop does arches = set() for package in self.others: if package.arch not in arches and not arches.add(package.arch): yield PackageStandin(package)
def package_links(self): '''Returns either actual packages or package-standins for virtual pkgbase packages.''' if self.packages: # we have real packages- just yield each in sequence for package in self.packages: yield package else: # fake out the template- this is slightly hacky but yields one # 'package-like' object per arch which is what the normal loop does by_arch = defaultdict(list) for package in self.others: by_arch[package.arch].append(package) for arch, packages in by_arch.items(): if len(packages) == 1: yield packages[0] else: yield PackageStandin(packages[0])