diff options
Diffstat (limited to 'portage_with_autodep/pym/_emerge/BlockerCache.py')
-rw-r--r-- | portage_with_autodep/pym/_emerge/BlockerCache.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/portage_with_autodep/pym/_emerge/BlockerCache.py b/portage_with_autodep/pym/_emerge/BlockerCache.py index 5c4f43e..fce81f8 100644 --- a/portage_with_autodep/pym/_emerge/BlockerCache.py +++ b/portage_with_autodep/pym/_emerge/BlockerCache.py @@ -1,6 +1,7 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2012 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 @@ -15,6 +16,9 @@ except ImportError: if sys.hexversion >= 0x3000000: basestring = str long = int + _unicode = str +else: + _unicode = unicode class BlockerCache(portage.cache.mappings.MutableMapping): """This caches blockers of installed packages so that dep_check does not @@ -58,8 +62,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, EOFError, 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 @@ -141,7 +148,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping): f.close() portage.util.apply_secpass_permissions( self._cache_filename, gid=portage.portage_gid, mode=0o644) - except (IOError, OSError) as e: + except (IOError, OSError): pass self._modified.clear() @@ -155,8 +162,8 @@ class BlockerCache(portage.cache.mappings.MutableMapping): @param blocker_data: An object with counter and atoms attributes. @type blocker_data: BlockerData """ - self._cache_data["blockers"][cpv] = \ - (blocker_data.counter, tuple(str(x) for x in blocker_data.atoms)) + self._cache_data["blockers"][_unicode(cpv)] = (blocker_data.counter, + tuple(_unicode(x) for x in blocker_data.atoms)) self._modified.add(cpv) def __iter__(self): @@ -176,7 +183,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping): def __getitem__(self, cpv): """ @rtype: BlockerData - @returns: An object with counter and atoms attributes. + @return: An object with counter and atoms attributes. """ return self.BlockerData(*self._cache_data["blockers"][cpv]) |