Commits

Michał Górny committed 70c49d5

pkgcore: use rich comparisons.

  • Participants
  • Parent commits d4ee345

Comments (0)

Files changed (2)

File gentoopm/pkgcorepm/pkg.py

 	def atom(self):
 		return PkgCoreAtom('=%s' % self.id, self)
 
-	def __cmp__(self, other):
+	def __lt__(self, other):
 		if not isinstance(other, PkgCorePackage):
 			raise TypeError('Unable to compare %s against %s' % \
 					(self, other))
-		return cmp(self._pkg, other._pkg) \
-				or cmp(other._repo_index, self._repo_index)
+		return self._pkg < other._pkg \
+				or other._repo_index < self._repo_index
 
 class PkgCoreMetadata(PMPackageMetadata):
 	def __init__(self, pkg):

File gentoopm/pkgcorepm/repo.py

 	def path(self):
 		return self._repo.location
 
-	def __cmp__(self, other):
-		return cmp(other._index, self._index)
+	def __lt__(self, other):
+		return other._index < self._index
 
 class PkgCoreInstalledRepo(PkgCoreRepository):
 	pass