Merged from trunk -r15493:15497
authorFabian Groffen <grobian@gentoo.org>
Sun, 28 Feb 2010 14:19:16 +0000 (14:19 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 28 Feb 2010 14:19:16 +0000 (14:19 -0000)
   | 15494   | Remove print() usage.                                        |
   | zmedico |                                                              |

   | 15495   | Remove print() usage.                                        |
   | zmedico |                                                              |

   | 15496   | Fix broken reference to portage._spawn_misc_sh(). Thanks to  |
   | zmedico | Arfrever for reporting.                                      |

   | 15497   | Add ObjectProxy __gt__, __ge__, __lt__, and __le__ methods   |
   | zmedico | to fix TypeError 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()                                                        |

svn path=/main/branches/prefix/; revision=15500

pym/portage/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py
pym/portage/proxy/objectproxy.py

index e7c9a04d4d88e7df0f93d65a05bf240b2643e9f0..a2f9b4ab2f87b679a1d5a9d1a4cee480b188bb7a 100644 (file)
@@ -509,7 +509,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 6e5519eef59a6020f614929ad853b2f25e5aba37..5013f78749c1ec040fc400093b4ab1809e4636b4 100644 (file)
@@ -2,8 +2,6 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-from __future__ import print_function
-
 __all__ = ["bindbapi", "binarytree"]
 
 import portage
@@ -868,7 +866,6 @@ class binarytree(object):
                                mykey = portage.cpv_getkey(fullpkg)
                                try:
                                        # invalid tbz2's can hurt things.
-                                       #print "cpv_inject("+str(fullpkg)+")"
                                        self.dbapi.cpv_inject(fullpkg)
                                        remote_metadata = self.__remotepkgs[mypkg]
                                        for k, v in remote_metadata.items():
@@ -885,7 +882,6 @@ class binarytree(object):
                                                remote_metadata.pop(k, None)
 
                                        self._remotepkgs[fullpkg] = remote_metadata
-                                       #print "  -- Injected"
                                except SystemExit as e:
                                        raise
                                except:
@@ -1151,7 +1147,6 @@ class binarytree(object):
        def gettbz2(self, pkgname):
                """Fetches the package from a remote site, if necessary.  Attempts to
                resume if the file appears to be partially downloaded."""
-               print("Fetching '"+str(pkgname)+"'")
                tbz2_path = self.getname(pkgname)
                tbz2name = os.path.basename(tbz2_path)
                resume = False
index 39dd6eb8ced0d2f4e26bf757f1bb52a4a9e3269a..124783ca25e7af7691d2f07176c4b8b20da6549c 100644 (file)
@@ -2,8 +2,6 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-from __future__ import print_function
-
 __all__ = [
        "close_portdbapi_caches", "FetchlistDict", "portagetree", "portdbapi"
 ]
@@ -809,8 +807,8 @@ class portdbapi(dbapi):
                checksums = mf.getDigests()
                if not checksums:
                        if debug: 
-                               print("[empty/missing/bad digest]: "+mypkg)
-                       return None
+                               writemsg("[empty/missing/bad digest]: %s\n" % (mypkg,))
+                       return {}
                filesdict={}
                myfiles = self.getFetchMap(mypkg, useflags=useflags)
                #XXX: maybe this should be improved: take partial downloads
@@ -1091,8 +1089,8 @@ class portdbapi(dbapi):
                        else:
                                myval = list(self._iter_match(mydep, self.cp_list(mykey)))
                else:
-                       print("ERROR: xmatch doesn't handle", level, "query!")
-                       raise KeyError
+                       raise AssertionError(
+                               "Invalid level argument: '%s'" % level)
 
                if self.frozen and (level not in ["match-list", "bestmatch-list"]):
                        self.xcache[level][mydep] = myval
index 618f8be44c6638a80c4fe3ffbdd2f0a770593a88..1e1d6c693155534318f67f4d56195ad11ebdad06 100644 (file)
@@ -5391,7 +5391,7 @@ class dblink(object):
                                        phase = 'die_hooks'
 
                                if self._scheduler is None:
-                                       portage._spawn_misc_sh(self.settings, [phase],
+                                       _spawn_misc_sh(self.settings, [phase],
                                                phase=phase)
                                else:
                                        self._scheduler.dblinkEbuildPhase(
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