Fix all remaining SyntaxErrors with Python 3.
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Mon, 21 Sep 2009 12:16:07 +0000 (12:16 -0000)
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Mon, 21 Sep 2009 12:16:07 +0000 (12:16 -0000)
svn path=/main/trunk/; revision=14315

pym/portage/checksum.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/getbinpkg.py
pym/portage/process.py
pym/portage/util.py

index ee2e51c71d8cdbdf4e436d3222743b0b65a4f976..93076d3041692de6b9c9d226872b74a3372a407e 100644 (file)
@@ -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
index 9473798e1ceefaf153e6a4af9c5145877f9f6ee5..1eb9d7d8a0b201a92da6482accc8dc973b63e844 100644 (file)
@@ -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:
index 31bde127ae20f39b4726925174ec27ae4cbc1343..ff26476ac66630e926c5e873c1b49d5a85dc3154 100644 (file)
@@ -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
index b5d24c857dfc02f824ae75d5312b6b58c4c6b0d6..2003fdbdc0a3bdaf5c5f2e5261cfc3259782154b 100644 (file)
@@ -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)
 
index 9698743f81fb54bdfe6ade9044b304a7f74f8546..2329e6a1bd6458827a3149d60a03ea3fe8fabf57 100644 (file)
@@ -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)
 
index a85948962f7fd5980ea472939a60a29616e6e000..60e72fbb4af08ef6c5015fddf6641a0c444385c9 100644 (file)
@@ -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]=="#":