From bda55a1f3cd10f5463228cb882c5b6b67d8937ae Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Mon, 21 Sep 2009 12:16:07 +0000 Subject: Fix all remaining SyntaxErrors with Python 3. svn path=/main/trunk/; revision=14315 --- pym/portage/checksum.py | 2 +- pym/portage/dbapi/bintree.py | 8 ++++---- pym/portage/dbapi/vartree.py | 6 +++--- pym/portage/getbinpkg.py | 2 +- pym/portage/process.py | 5 ++++- pym/portage/util.py | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index ee2e51c71..93076d304 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -279,6 +279,6 @@ def perform_multiple_checksums(filename, hashes=["MD5"], calc_prelink=0): rVal = {} for x in hashes: if x not in hashfunc_map: - raise portage.exception.DigestException, x+" hash function not available (needs dev-python/pycrypto or >=dev-lang/python-2.5)" + raise portage.exception.DigestException(x+" hash function not available (needs dev-python/pycrypto or >=dev-lang/python-2.5)") rVal[x] = perform_checksum(filename, x, calc_prelink)[0] return rVal diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 9473798e1..1eb9d7d8a 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -91,15 +91,15 @@ class bindbapi(fakedbapi): if myval: mydata[x] = " ".join(myval.split()) - if not mydata.setdefault('EAPI', u'0'): - mydata['EAPI'] = u'0' + if not mydata.setdefault('EAPI', _unicode_decode('0')): + mydata['EAPI'] = _unicode_decode('0') if cache_me: aux_cache = self._aux_cache_slot_dict() for x in self._aux_cache_keys: - aux_cache[x] = mydata.get(x, u'') + aux_cache[x] = mydata.get(x, _unicode_decode('')) self._aux_cache[mycpv] = aux_cache - return [mydata.get(x, u'') for x in wants] + return [mydata.get(x, _unicode_decode('')) for x in wants] def aux_update(self, cpv, values): if not self.bintree.populated: diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 31bde127a..ff26476ac 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1244,7 +1244,7 @@ class vardbapi(dbapi): if not mydata['SLOT']: # Empty slot triggers InvalidAtom exceptions when generating slot # atoms for packages, so translate it to '0' here. - mydata['SLOT'] = u'0' + mydata['SLOT'] = _unicode_decode('0') return [mydata[x] for x in wants] def _aux_get(self, mycpv, wants, st=None): @@ -1281,9 +1281,9 @@ class vardbapi(dbapi): if self._aux_multi_line_re.match(x) is None: myd = " ".join(myd.split()) except IOError: - myd = u'' + myd = _unicode_decode('') if x == "EAPI" and not myd: - results.append(u'0') + results.append(_unicode_decode('0')) else: results.append(myd) return results diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index b5d24c857..2003fdbdc 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -177,7 +177,7 @@ def create_conn(baseurl,conn=None): t.connect(username=username, password=password) conn = paramiko.SFTPClient.from_transport(t) else: - raise NotImplementedError, _("%s is not a supported protocol.") % protocol + raise NotImplementedError(_("%s is not a supported protocol.") % protocol) return (conn,protocol,address, http_params, http_headers) diff --git a/pym/portage/process.py b/pym/portage/process.py index 9698743f8..2329e6a1b 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -118,7 +118,10 @@ def run_exitfuncs(): exc_info = sys.exc_info() if exc_info is not None: - raise exc_info[0], exc_info[1], exc_info[2] + if sys.hexversion >= 0x3000000: + raise exc_info[0](exc_info[1]).with_traceback(exc_info[2]) + else: + exec("raise exc_info[0], exc_info[1], exc_info[2]") atexit.register(run_exitfuncs) diff --git a/pym/portage/util.py b/pym/portage/util.py index a85948962..60e72fbb4 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -119,7 +119,7 @@ def grabfile(myfilename, compat_level=0, recursive=0): for x in mylines: #the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line #into single spaces. - myline = u' '.join(x.split()) + myline = _unicode_decode(' ').join(x.split()) if not len(myline): continue if myline[0]=="#": -- cgit v1.2.3-1-g7c22