diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-06-21 22:22:59 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-06-21 22:22:59 +0000 |
commit | 573fee199fea09c276f2ced3d48bfcdf6ccc4c9e (patch) | |
tree | 393f59b4a49cf3213cc4513042b4a9fe6d9ec804 | |
parent | d014be84174a082589abb1147997440e35878b09 (diff) | |
download | portage-573fee199fea09c276f2ced3d48bfcdf6ccc4c9e.tar.gz portage-573fee199fea09c276f2ced3d48bfcdf6ccc4c9e.tar.bz2 portage-573fee199fea09c276f2ced3d48bfcdf6ccc4c9e.zip |
Implement Atom.__cmp__() so that things like list.sort() work correctly
for Atom instances.
svn path=/main/trunk/; revision=10757
-rw-r--r-- | pym/portage/dep.py | 9 |
1 files changed, 9 insertions, 0 deletions
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. |