summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/BlockerCache.py10
-rw-r--r--pym/portage/dbapi/vartree.py7
-rw-r--r--pym/portage/getbinpkg.py2
-rw-r--r--pym/portage/util/_dyn_libs/PreservedLibsRegistry.py2
-rw-r--r--pym/portage/util/mtimedb.py8
5 files changed, 20 insertions, 9 deletions
diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py
index 5c4f43e52..8a1c88478 100644
--- a/pym/_emerge/BlockerCache.py
+++ b/pym/_emerge/BlockerCache.py
@@ -1,6 +1,7 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import errno
import sys
from portage.util import writemsg
from portage.data import secpass
@@ -58,8 +59,11 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
self._cache_data = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError) as e:
- if isinstance(e, pickle.UnpicklingError):
+ except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
+ if isinstance(e, EnvironmentError) and \
+ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
+ pass
+ else:
writemsg("!!! Error loading '%s': %s\n" % \
(self._cache_filename, str(e)), noiselevel=-1)
del e
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index ba2cc0886..4df0576a4 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -555,8 +555,11 @@ class vardbapi(dbapi):
aux_cache = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError) as e:
- if isinstance(e, pickle.UnpicklingError):
+ except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
+ if isinstance(e, EnvironmentError) and \
+ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
+ pass
+ else:
writemsg(_unicode_decode(_("!!! Error loading '%s': %s\n")) % \
(self._aux_cache_filename, e), noiselevel=-1)
del e
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index a511f51ff..a83e2a51c 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -542,7 +542,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
out.write(_("Loaded metadata pickle.\n"))
out.flush()
metadatafile.close()
- except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError):
+ except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError):
metadata = {}
if baseurl not in metadata:
metadata[baseurl]={}
diff --git a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py
index b916051a1..a1814981d 100644
--- a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py
+++ b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py
@@ -60,7 +60,7 @@ class PreservedLibsRegistry(object):
f = open(_unicode_encode(self._filename,
encoding=_encodings['fs'], errors='strict'), 'rb')
self._data = pickle.load(f)
- except (ValueError, pickle.UnpicklingError) as e:
+ except (AttributeError, ValueError, pickle.UnpicklingError) as e:
writemsg_level(_("!!! Error loading '%s': %s\n") % \
(self._filename, e), level=logging.ERROR, noiselevel=-1)
except (EOFError, IOError) as e:
diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py
index 67f93e819..bc4f97c53 100644
--- a/pym/portage/util/mtimedb.py
+++ b/pym/portage/util/mtimedb.py
@@ -9,6 +9,7 @@ try:
except ImportError:
import pickle
+import errno
import portage
from portage import _unicode_encode
from portage.data import portage_gid, uid
@@ -33,8 +34,11 @@ class MtimeDB(dict):
d = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError) as e:
- if isinstance(e, pickle.UnpicklingError):
+ except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
+ if isinstance(e, EnvironmentError) and \
+ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
+ pass
+ else:
writemsg(_("!!! Error loading '%s': %s\n") % \
(filename, str(e)), noiselevel=-1)
del e