def _compareProvider(self, x, y, compareArch): """ For compareArch, if x is more compatable return < 0 equally compatable return 0, otherwise return > 0 """ ret = arch.compareArchDistance(x, y, compareArch) if x == ret: return -1 elif y == ret: return 1 ret = cmp(y.name, x.name) if ret != 0: return ret return comparePoEVR(y, x)
def compareProvide(self, reqpkg, pkg1, pkg2): if pkg1 is None: return -1 if pkg2 is None: return 1 dist1 = self.provideDistance(reqpkg, pkg1) dist2 = self.provideDistance(reqpkg, pkg2) if dist1 < 0 and dist2 < 0: return 0 elif dist1 > dist2: return 1 elif dist1 < dist2: return -1 ret = arch.compareArchDistance(pkg1, pkg2, reqpkg.arch) if ret is None: return comparePoEVR(pkg1, pkg2) if ret is pkg1: return 1 return -1