From: Zac Medico Date: Sat, 21 Jun 2008 22:22:59 +0000 (-0000) Subject: Implement Atom.__cmp__() so that things like list.sort() work correctly X-Git-Tag: v2.2_rc2~357 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=573fee199fea09c276f2ced3d48bfcdf6ccc4c9e;p=portage.git Implement Atom.__cmp__() so that things like list.sort() work correctly for Atom instances. svn path=/main/trunk/; revision=10757 --- diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 23b26a3cb..3d3b5d954 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -440,6 +440,15 @@ class Atom(object): else: self.use = None + def __cmp__(self, other): + self_str = str(self) + other_str = str(other) + if self_str == other_str: + return 0 + if self_str > other_str: + return 1 + return -1 + def get_operator(mydep): """ Return the operator used in a depstring.