1 |
Author: zmedico |
2 |
Date: 2008-06-21 22:22:59 +0000 (Sat, 21 Jun 2008) |
3 |
New Revision: 10757 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dep.py |
7 |
Log: |
8 |
Implement Atom.__cmp__() so that things like list.sort() work correctly |
9 |
for Atom instances. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/dep.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/dep.py 2008-06-21 17:11:54 UTC (rev 10756) |
15 |
+++ main/trunk/pym/portage/dep.py 2008-06-21 22:22:59 UTC (rev 10757) |
16 |
@@ -440,6 +440,15 @@ |
17 |
else: |
18 |
self.use = None |
19 |
|
20 |
+ def __cmp__(self, other): |
21 |
+ self_str = str(self) |
22 |
+ other_str = str(other) |
23 |
+ if self_str == other_str: |
24 |
+ return 0 |
25 |
+ if self_str > other_str: |
26 |
+ return 1 |
27 |
+ return -1 |
28 |
+ |
29 |
def get_operator(mydep): |
30 |
""" |
31 |
Return the operator used in a depstring. |
32 |
|
33 |
-- |
34 |
gentoo-commits@l.g.o mailing list |