Python3: Don't use cmp() function

The built-in cmp() function has been removed in Python 3, so don't try to
use it.

Change-Id: Ic62b7032ec6fd555974fc0d818327879d53a8ff2
This commit is contained in:
Zane Bitter 2018-07-18 16:33:41 -04:00
parent eccdf10a93
commit c583cbf9b2
1 changed files with 6 additions and 2 deletions

View File

@ -457,13 +457,17 @@ class PackagesHandler(object):
p1_name = pkg1[0]
p2_name = pkg2[0]
if p1_name in order and p2_name in order:
return cmp(order.index(p1_name), order.index(p2_name))
i1 = order.index(p1_name)
i2 = order.index(p2_name)
return (i1 > i2) - (i1 < i2)
elif p1_name in order:
return -1
elif p2_name in order:
return 1
else:
return cmp(p1_name.lower(), p2_name.lower())
n1 = p1_name.lower()
n2 = p2_name.lower()
return (n1 > n2) - (n1 < n2)
def __init__(self, packages):
self._packages = packages