Use "key" instead of "cmp" when sorting excuses

Python3 has deprecated the "cmp" style sorting.

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2011-12-18 21:06:39 +01:00
parent ede3a592a8
commit e1b98db809

View File

@ -195,6 +195,7 @@ from migrationitem import MigrationItem, HintItem
from hints import HintCollection from hints import HintCollection
from britney import buildSystem from britney import buildSystem
from functools import reduce from functools import reduce
from operator import attrgetter
__author__ = 'Fabio Tranchitella and the Debian Release Team' __author__ = 'Fabio Tranchitella and the Debian Release Team'
__version__ = '2.0' __version__ = '2.0'
@ -1595,7 +1596,7 @@ class Britney:
self.excuses.append(excuse) self.excuses.append(excuse)
# sort the excuses by daysold and name # sort the excuses by daysold and name
self.excuses.sort(lambda x, y: cmp(x.daysold, y.daysold) or cmp(x.name, y.name)) self.excuses.sort(key=attrgetter('daysold', 'name'))
# extract the not considered packages, which are in the excuses but not in upgrade_me # extract the not considered packages, which are in the excuses but not in upgrade_me
unconsidered = [e.name for e in self.excuses if e.name not in upgrade_me] unconsidered = [e.name for e in self.excuses if e.name not in upgrade_me]