Commits

Michał Górny  committed d34c9cf

Fix package sorting in portage.

  • Participants
  • Parent commits 91c5107

Comments (0)

Files changed (1)

File gentoopm/portagepm/pkg.py

 		if not isinstance(other, PortageDBCPV):
 			raise TypeError('Unable to compare %s against %s' % \
 					(self, other))
-		return self.key < other.key or self.version < other.version
+
+		if self.key < other.key:
+			return True
+		if self.key == other.key:
+			return self.version < other.version
+		return False
 
 class PortageCPV(PortageDBCPV, PMInstallablePackage):
 	def __init__(self, cpv, dbapi, tree, repo_prio):
 		if not isinstance(other, PortageCPV):
 			raise TypeError('Unable to compare %s against %s' % \
 					(self, other))
-		return self.key < other.key or self.version < other.version \
-				or self._repo_prio < other._repo_prio
+
+		if self.key < other.key:
+			return True
+		if self.key == other.key:
+			if self.version < other.version:
+				return True
+			if self.version == other.version:
+				return self._repo_prio < other._repo_prio
+		return False
 
 class PortageVDBCPV(PortageDBCPV, PMInstalledPackage):
 	@property