summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-05 03:03:50 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-05 03:03:50 +0000
commit29950d3be0b14877587dec725eeabbb949e0d616 (patch)
treed838a6f5787600da5f9d64437caacd4b2e16d5e9
parent7270ee7ebb0dccc83a073a04e73d66346d6e698d (diff)
downloadportage-29950d3be0b14877587dec725eeabbb949e0d616.tar.gz
portage-29950d3be0b14877587dec725eeabbb949e0d616.tar.bz2
portage-29950d3be0b14877587dec725eeabbb949e0d616.zip
Set Unpickler.find_global = None when possible and handle AttributeError
for py3k. svn path=/main/trunk/; revision=12751
-rw-r--r--pym/_emerge/__init__.py5
-rw-r--r--pym/portage/__init__.py5
-rw-r--r--pym/portage/dbapi/vartree.py5
-rw-r--r--pym/portage/getbinpkg.py8
4 files changed, 22 insertions, 1 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 8abe080f9..a53d58a8f 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -4105,6 +4105,11 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
try:
f = open(self._cache_filename, mode='rb')
mypickle = pickle.Unpickler(f)
+ try:
+ mypickle.find_global = None
+ except AttributeError:
+ # TODO: If py3k, override Unpickler.find_class().
+ pass
self._cache_data = mypickle.load()
f.close()
del f
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index b9365ff36..26860de80 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7819,6 +7819,11 @@ class MtimeDB(dict):
try:
f = open(filename, 'rb')
mypickle = pickle.Unpickler(f)
+ try:
+ mypickle.find_global = None
+ except AttributeError:
+ # TODO: If py3k, override Unpickler.find_class().
+ pass
d = mypickle.load()
f.close()
del f
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 7509f06f5..63705d27c 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1059,6 +1059,11 @@ class vardbapi(dbapi):
try:
f = open(self._aux_cache_filename, mode='rb', **open_kwargs)
mypickle = pickle.Unpickler(f)
+ try:
+ mypickle.find_global = None
+ except AttributeError:
+ # TODO: If py3k, override Unpickler.find_class().
+ pass
aux_cache = mypickle.load()
f.close()
del f
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index bb3911a6b..02e5de277 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -486,7 +486,13 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
out = sys.stdout
try:
metadatafile = open(metadatafilename, 'rb')
- metadata = pickle.load(metadatafile)
+ mypickle = pickle.Unpickler(metadatafile)
+ try:
+ mypickle.find_global = None
+ except AttributeError:
+ # TODO: If py3k, override Unpickler.find_class().
+ pass
+ metadata = mypickle.load()
out.write("Loaded metadata pickle.\n")
out.flush()
metadatafile.close()