From 63b4c0a4b1f595d499c67b7372151fd4f5204974 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 28 Feb 2010 14:19:16 +0000 Subject: [PATCH] Merged from trunk -r15493:15497 | 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 | 2 +- pym/portage/dbapi/bintree.py | 5 ----- pym/portage/dbapi/porttree.py | 10 ++++------ pym/portage/dbapi/vartree.py | 2 +- pym/portage/proxy/objectproxy.py | 12 ++++++++++++ 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index e7c9a04d4..a2f9b4ab2 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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 diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 6e5519eef..5013f7874 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -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 diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 39dd6eb8c..124783ca2 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 618f8be44..1e1d6c693 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -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( diff --git a/pym/portage/proxy/objectproxy.py b/pym/portage/proxy/objectproxy.py index d392beb60..3e5191671 100644 --- a/pym/portage/proxy/objectproxy.py +++ b/pym/portage/proxy/objectproxy.py @@ -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 -- 2.26.2