From 573fee199fea09c276f2ced3d48bfcdf6ccc4c9e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 21 Jun 2008 22:22:59 +0000 Subject: [PATCH] Implement Atom.__cmp__() so that things like list.sort() work correctly for Atom instances. svn path=/main/trunk/; revision=10757 --- pym/portage/dep.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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. -- 2.26.2