Add ObjectProxy __gt__, __ge__, __lt__, and __le__ methods to fix TypeError
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 21:09:52 +0000 (21:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 21:09:52 +0000 (21:09 -0000)
with python3 reported by Arfrever:

  File "/usr/lib/portage/pym/portage/__init__.py", line 513, in portageexit
    if secpass > 1 and os.environ.get("SANDBOX_ON") != "1":
TypeError: unorderable types: _LazyImportFrom() > int() (trunk r15497)

svn path=/main/branches/2.1.7/; revision=15698

pym/portage/__init__.py
pym/portage/proxy/objectproxy.py

index 9d0f929b22864fb4d861345c02d2fb2bc76563c9..213d4ebb5bf9de9b7fb5de55028fe75150c0e53d 100644 (file)
@@ -510,7 +510,7 @@ auxdbkeys = (
 auxdbkeylen=len(auxdbkeys)
 
 def portageexit():
-       if secpass > 1 and os.environ.get("SANDBOX_ON") != "1":
+       if data.secpass > 1 and os.environ.get("SANDBOX_ON") != "1":
                close_portdbapi_caches()
                try:
                        mtimedb
index d392beb6032e22370ffad7ee2bb927c2116ca16c..3e5191671d16e748ae8058fd29e1484fd7d074d2 100644 (file)
@@ -61,6 +61,18 @@ class ObjectProxy(object):
        def __hash__(self):
                return hash(object.__getattribute__(self, '_get_target')())
 
+       def __ge__(self, other):
+               return object.__getattribute__(self, '_get_target')() >= other
+
+       def __gt__(self, other):
+               return object.__getattribute__(self, '_get_target')() > other
+
+       def __le__(self, other):
+               return object.__getattribute__(self, '_get_target')() <= other
+
+       def __lt__(self, other):
+               return object.__getattribute__(self, '_get_target')() < other
+
        def __eq__(self, other):
                return object.__getattribute__(self, '_get_target')() == other