Logo Search packages:      
Sourcecode: yum version File versions  Download package

def yum::YumBase::bestPackageFromList (   self,
  pkglist 
)

take list of package objects and return the best package object.
   If the list is empty, raise Errors.YumBaseError

Definition at line 1342 of file __init__.py.

01342                                           :
        """take list of package objects and return the best package object.
           If the list is empty, raise Errors.YumBaseError"""
        
        
        if len(pkglist) == 0:
            return None
            
        if len(pkglist) == 1:
            return pkglist[0]
        
        mysack = ListPackageSack()
        mysack.addList(pkglist)
        bestlist = mysack.returnNewestByNameArch() # get rid of all lesser vers
        
        best = bestlist[0]
        for pkg in bestlist[1:]:
            if len(pkg.name) < len(best.name): # shortest name silliness
                best = pkg
                continue
            elif len(pkg.name) > len(best.name):
                continue

            # compare arch
            arch = rpmUtils.arch.getBestArchFromList([pkg.arch, best.arch])
            if arch == pkg.arch:
                best = pkg
                continue

        return best

    def returnInstalledPackagesByDep(self, depstring):


Generated by  Doxygen 1.6.0   Back to index