summaryrefslogtreecommitdiffstats
path: root/pym/portage/cache
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/cache')
-rw-r--r--pym/portage/cache/anydbm.py4
-rw-r--r--pym/portage/cache/ebuild_xattr.py10
-rw-r--r--pym/portage/cache/flat_hash.py14
-rw-r--r--pym/portage/cache/flat_list.py12
-rw-r--r--pym/portage/cache/metadata.py8
-rw-r--r--pym/portage/cache/sql_template.py24
-rw-r--r--pym/portage/cache/sqlite.py4
-rw-r--r--pym/portage/cache/template.py2
-rw-r--r--pym/portage/cache/util.py10
9 files changed, 44 insertions, 44 deletions
diff --git a/pym/portage/cache/anydbm.py b/pym/portage/cache/anydbm.py
index 226c6d7d0..5b771adad 100644
--- a/pym/portage/cache/anydbm.py
+++ b/pym/portage/cache/anydbm.py
@@ -38,7 +38,7 @@ class database(fs_template.FsBased):
try:
self._ensure_dirs()
self._ensure_dirs(self._db_path)
- except (OSError, IOError), e:
+ except (OSError, IOError) as e:
raise cache_errors.InitializationError(self.__class__, e)
# try again if failed
@@ -46,7 +46,7 @@ class database(fs_template.FsBased):
if self.__db == None:
self.__db = anydbm_module.open(
_unicode_encode(self._db_path), 'c', self._perms)
- except anydbm_module.error, e:
+ except anydbm_module.error as e:
raise cache_errors.InitializationError(self.__class__, e)
self._ensure_access(self._db_path)
diff --git a/pym/portage/cache/ebuild_xattr.py b/pym/portage/cache/ebuild_xattr.py
index fa3937e2f..4bcc6c846 100644
--- a/pym/portage/cache/ebuild_xattr.py
+++ b/pym/portage/cache/ebuild_xattr.py
@@ -35,7 +35,7 @@ class database(fs_template.FsBased):
path = os.path.join(self.portdir,'profiles/repo_name')
try:
return int(self.__get(path,'value_max_len'))
- except NoValueException,e:
+ except NoValueException as e:
max = self.__calc_max(path)
self.__set(path,'value_max_len',str(max))
return max
@@ -54,7 +54,7 @@ class database(fs_template.FsBased):
while True:
self.__set(path,'test_max',s)
s+=hundred
- except IOError,e:
+ except IOError as e:
# ext based give wrong errno
# http://bugzilla.kernel.org/show_bug.cgi?id=12793
if e.errno in (E2BIG,ENOSPC):
@@ -64,7 +64,7 @@ class database(fs_template.FsBased):
try:
self.__remove(path,'test_max')
- except IOError,e:
+ except IOError as e:
if e.errno is not ENODATA:
raise e
@@ -77,7 +77,7 @@ class database(fs_template.FsBased):
def __has_cache(self,path):
try:
self.__get(path,'_mtime_')
- except NoValueException,e:
+ except NoValueException as e:
return False
return True
@@ -85,7 +85,7 @@ class database(fs_template.FsBased):
def __get(self,path,key,default=None):
try:
return xattr.get(path,key,namespace=self.ns)
- except IOError,e:
+ except IOError as e:
if not default is None and ENODATA == e.errno:
return default
else:
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py
index 259be4108..3f46df8b9 100644
--- a/pym/portage/cache/flat_hash.py
+++ b/pym/portage/cache/flat_hash.py
@@ -43,7 +43,7 @@ class database(fs_template.FsBased):
return d
finally:
myf.close()
- except (IOError, OSError), e:
+ except (IOError, OSError) as e:
if e.errno != errno.ENOENT:
raise cache_errors.CacheCorruption(cpv, e)
raise KeyError(cpv)
@@ -51,7 +51,7 @@ class database(fs_template.FsBased):
def _parse_data(self, data, cpv):
try:
d = dict(map(lambda x:x.rstrip("\n").split("=", 1), data))
- except ValueError, e:
+ except ValueError as e:
# If a line is missing an "=", the split length is 1 instead of 2.
raise cache_errors.CacheCorruption(cpv, e)
return d
@@ -65,7 +65,7 @@ class database(fs_template.FsBased):
encoding=_encodings['fs'], errors='strict'),
mode='w', encoding=_encodings['repo.content'],
errors='backslashreplace')
- except (IOError, OSError), e:
+ except (IOError, OSError) as e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
@@ -73,7 +73,7 @@ class database(fs_template.FsBased):
encoding=_encodings['fs'], errors='strict'),
mode='w', encoding=_encodings['repo.content'],
errors='backslashreplace')
- except (OSError, IOError),e:
+ except (OSError, IOError) as e:
raise cache_errors.CacheCorruption(cpv, e)
else:
raise cache_errors.CacheCorruption(cpv, e)
@@ -93,7 +93,7 @@ class database(fs_template.FsBased):
new_fp = os.path.join(self.location,cpv)
try:
os.rename(fp, new_fp)
- except (OSError, IOError), e:
+ except (OSError, IOError) as e:
os.remove(fp)
raise cache_errors.CacheCorruption(cpv, e)
@@ -102,7 +102,7 @@ class database(fs_template.FsBased):
# import pdb;pdb.set_trace()
try:
os.remove(os.path.join(self.location,cpv))
- except OSError, e:
+ except OSError as e:
if errno.ENOENT == e.errno:
raise KeyError(cpv)
else:
@@ -120,7 +120,7 @@ class database(fs_template.FsBased):
while len(dirs):
try:
dir_list = os.listdir(dirs[0])
- except OSError, e:
+ except OSError as e:
if e.errno != errno.ENOENT:
raise
del e
diff --git a/pym/portage/cache/flat_list.py b/pym/portage/cache/flat_list.py
index 1d4dbd28f..cfa3340cd 100644
--- a/pym/portage/cache/flat_list.py
+++ b/pym/portage/cache/flat_list.py
@@ -38,14 +38,14 @@ class database(fs_template.FsBased):
errors='replace')
for k,v in zip(self.auxdbkey_order, myf):
d[k] = v.rstrip("\n")
- except (OSError, IOError),e:
+ except (OSError, IOError) as e:
if errno.ENOENT == e.errno:
raise KeyError(cpv)
raise cache_errors.CacheCorruption(cpv, e)
try:
d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
- except OSError, e:
+ except OSError as e:
myf.close()
raise cache_errors.CacheCorruption(cpv, e)
myf.close()
@@ -60,7 +60,7 @@ class database(fs_template.FsBased):
encoding=_encodings['fs'], errors='strict'),
mode='w', encoding=_encodings['repo.content'],
errors='backslashreplace')
- except (OSError, IOError), e:
+ except (OSError, IOError) as e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
@@ -68,7 +68,7 @@ class database(fs_template.FsBased):
encoding=_encodings['fs'], errors='strict'),
mode='w', encoding=_encodings['repo.content'],
errors='backslashreplace')
- except (OSError, IOError),e:
+ except (OSError, IOError) as e:
raise cache_errors.CacheCorruption(cpv, e)
else:
raise cache_errors.CacheCorruption(cpv, e)
@@ -83,7 +83,7 @@ class database(fs_template.FsBased):
new_fp = os.path.join(self._base,cpv)
try:
os.rename(fp, new_fp)
- except (OSError, IOError), e:
+ except (OSError, IOError) as e:
os.remove(fp)
raise cache_errors.CacheCorruption(cpv, e)
@@ -91,7 +91,7 @@ class database(fs_template.FsBased):
def _delitem(self, cpv):
try:
os.remove(os.path.join(self._base,cpv))
- except OSError, e:
+ except OSError as e:
if errno.ENOENT == e.errno:
raise KeyError(cpv)
else:
diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py
index ff1227bdb..8b35593c2 100644
--- a/pym/portage/cache/metadata.py
+++ b/pym/portage/cache/metadata.py
@@ -61,7 +61,7 @@ class database(flat_hash.database):
try:
d["_eclasses_"] = self.ec.get_eclass_data(
d["INHERITED"].split())
- except KeyError, e:
+ except KeyError as e:
# INHERITED contains a non-existent eclass.
raise cache_errors.CacheCorruption(cpv, e)
del d["INHERITED"]
@@ -122,13 +122,13 @@ class database(flat_hash.database):
try:
myf = open(_unicode_encode(fp,
encoding=_encodings['fs'], errors='strict'), 'wb')
- except EnvironmentError, e:
+ except EnvironmentError as e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
myf = open(_unicode_encode(fp,
encoding=_encodings['fs'], errors='strict'), 'wb')
- except EnvironmentError, e:
+ except EnvironmentError as e:
raise cache_errors.CacheCorruption(cpv, e)
else:
raise cache_errors.CacheCorruption(cpv, e)
@@ -141,7 +141,7 @@ class database(flat_hash.database):
try:
os.rename(fp, new_fp)
- except EnvironmentError, e:
+ except EnvironmentError as e:
try:
os.unlink(fp)
except EnvironmentError:
diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py
index a002d6c06..a4580bdc7 100644
--- a/pym/portage/cache/sql_template.py
+++ b/pym/portage/cache/sql_template.py
@@ -74,7 +74,7 @@ class SQLDatabase(template.database):
self.SCHEMA_PACKAGE_NAME)
try:
self.con.execute(self.SCHEMA_PACKAGE_CREATE)
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.InitializationError(self.__class__, e)
if not self._table_exists(self.SCHEMA_VALUES_NAME):
@@ -83,7 +83,7 @@ class SQLDatabase(template.database):
self.SCHEMA_VALUES_NAME)
try:
self.con.execute(self.SCHEMA_VALUES_CREATE)
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.InitializationError(self.__class__, e)
@@ -103,7 +103,7 @@ class SQLDatabase(template.database):
self.con.execute("SELECT key, value FROM %s NATURAL JOIN %s "
"WHERE label=%s AND cpv=%s" % (self.SCHEMA_PACKAGE_NAME, self.SCHEMA_VALUES_NAME,
self.label, self._sfilter(cpv)))
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.CacheCorruption(self, cpv, e)
rows = self.con.fetchall()
@@ -126,7 +126,7 @@ class SQLDatabase(template.database):
(self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv)))
if self.autocommits:
self.commit()
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.CacheCorruption(self, cpv, e)
if self.con.rowcount <= 0:
raise KeyError(cpv)
@@ -148,7 +148,7 @@ class SQLDatabase(template.database):
# insert.
try:
pkgid = self._insert_cpv(cpv)
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.CacheCorruption(cpv, e)
# __getitem__ fills out missing values,
@@ -162,7 +162,7 @@ class SQLDatabase(template.database):
try:
self.con.executemany("INSERT INTO %s (pkgid, key, value) VALUES(\"%s\", %%(key)s, %%(value)s)" % \
(self.SCHEMA_VALUES_NAME, str(pkgid)), db_values)
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.CacheCorruption(cpv, e)
if self.autocommits:
self.commit()
@@ -210,13 +210,13 @@ class SQLDatabase(template.database):
if not self.autocommits:
try:
self.commit()
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.GeneralCacheCorruption(e)
try:
self.con.execute("SELECT cpv FROM %s WHERE label=%s AND cpv=%s" % \
(self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv)))
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.GeneralCacheCorruption(e)
return self.con.rowcount > 0
@@ -225,13 +225,13 @@ class SQLDatabase(template.database):
if not self.autocommits:
try:
self.commit()
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.GeneralCacheCorruption(e)
try:
self.con.execute("SELECT cpv FROM %s WHERE label=%s" %
(self.SCHEMA_PACKAGE_NAME, self.label))
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.GeneralCacheCorruption(e)
# return [ row[0] for row in self.con.fetchall() ]
for x in self.con.fetchall():
@@ -242,7 +242,7 @@ class SQLDatabase(template.database):
self.con.execute("SELECT cpv, key, value FROM %s NATURAL JOIN %s "
"WHERE label=%s" % (self.SCHEMA_PACKAGE_NAME, self.SCHEMA_VALUES_NAME,
self.label))
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.CacheCorruption(self, cpv, e)
oldcpv = None
@@ -288,7 +288,7 @@ class SQLDatabase(template.database):
try:
self.con.execute("SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % \
(self.label, query))
- except self._BaseError, e:
+ except self._BaseError as e:
raise cache_errors.GeneralCacheCorruption(e)
return [ row[0] for row in self.con.fetchall() ]
diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py
index d5f765459..073ca2cd8 100644
--- a/pym/portage/cache/sqlite.py
+++ b/pym/portage/cache/sqlite.py
@@ -70,7 +70,7 @@ class database(fs_template.FsBased):
raise cache_errors.InitializationError(self.__class__, "can't ensure perms on %s" % self._dbpath)
self._db_init_cache_size(config["cache_bytes"])
self._db_init_synchronous(config["synchronous"])
- except self._db_error, e:
+ except self._db_error as e:
raise cache_errors.InitializationError(self.__class__, e)
def _db_init_structures(self):
@@ -189,7 +189,7 @@ class database(fs_template.FsBased):
try:
s = " ".join(update_statement)
cursor.execute(s)
- except self._db_error, e:
+ except self._db_error as e:
writemsg("%s: %s\n" % (cpv, str(e)))
raise
diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py
index 97adb1058..d4573c760 100644
--- a/pym/portage/cache/template.py
+++ b/pym/portage/cache/template.py
@@ -173,7 +173,7 @@ class database(object):
restricts[key] = re.compile(match).match
else:
restricts[key] = re.compile(match[0],match[1]).match
- except re.error, e:
+ except re.error as e:
raise InvalidRestriction(key, match, e)
if key not in self.__known_keys:
raise InvalidRestriction(key, match, "Key isn't valid")
diff --git a/pym/portage/cache/util.py b/pym/portage/cache/util.py
index 57d328ced..7b2f1026a 100644
--- a/pym/portage/cache/util.py
+++ b/pym/portage/cache/util.py
@@ -33,11 +33,11 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
dead_nodes.discard(x)
try:
entry = src_cache[x]
- except KeyError, e:
+ except KeyError as e:
noise.missing_entry(x)
del e
continue
- except cache_errors.CacheError, ce:
+ except cache_errors.CacheError as ce:
noise.exception(x, ce)
del ce
continue
@@ -82,7 +82,7 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
try:
inherited = entry.get("INHERITED", "")
eclasses = entry.get("_eclasses_")
- except cache_errors.CacheError, ce:
+ except cache_errors.CacheError as ce:
noise.exception(x, ce)
del ce
continue
@@ -123,7 +123,7 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
# been updated/translated (if needs be, for metadata/cache mainly)
try:
trg_cache[x] = entry
- except cache_errors.CacheError, ce:
+ except cache_errors.CacheError as ce:
noise.exception(x, ce)
del ce
continue
@@ -141,7 +141,7 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
del trg_cache[key]
except KeyError:
pass
- except cache_errors.CacheError, ce:
+ except cache_errors.CacheError as ce:
noise.exception(ce)
del ce
noise.finish()