from UserDict import DictMixin
try:
- import cPickle
+ import cPickle as pickle
except ImportError:
- import pickle as cPickle
+ import pickle
try:
import cStringIO as StringIO
def _load(self):
try:
f = open(self._cache_filename)
- mypickle = cPickle.Unpickler(f)
+ mypickle = pickle.Unpickler(f)
mypickle.find_global = None
self._cache_data = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, cPickle.UnpicklingError), e:
- if isinstance(e, cPickle.UnpicklingError):
+ except (IOError, OSError, EOFError, pickle.UnpicklingError), e:
+ if isinstance(e, pickle.UnpicklingError):
writemsg("!!! Error loading '%s': %s\n" % \
(self._cache_filename, str(e)), noiselevel=-1)
del e
secpass >= 2:
try:
f = portage.util.atomic_ofstream(self._cache_filename)
- cPickle.dump(self._cache_data, f, -1)
+ pickle.dump(self._cache_data, f, -1)
f.close()
portage.util.apply_secpass_permissions(
self._cache_filename, gid=portage.portage_gid, mode=0644)
import shutil
import time
try:
- import cPickle
+ import cPickle as pickle
except ImportError:
- import pickle as cPickle
+ import pickle
import stat
import commands
d.update(mydict)
try:
f = atomic_ofstream(filename)
- cPickle.dump(d, f, -1)
+ pickle.dump(d, f, -1)
f.close()
portage.util.apply_secpass_permissions(filename, uid=uid, gid=portage_gid, mode=0664)
except (IOError, OSError), e:
def _load(self, filename):
try:
f = open(filename)
- mypickle = cPickle.Unpickler(f)
+ mypickle = pickle.Unpickler(f)
mypickle.find_global = None
d = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, cPickle.UnpicklingError), e:
- if isinstance(e, cPickle.UnpicklingError):
+ except (IOError, OSError, EOFError, pickle.UnpicklingError), e:
+ if isinstance(e, pickle.UnpicklingError):
writemsg("!!! Error loading '%s': %s\n" % \
(filename, str(e)), noiselevel=-1)
del e
from itertools import izip
try:
- import cPickle
+ import cPickle as pickle
except ImportError:
- import pickle as cPickle
+ import pickle
class PreservedLibsRegistry(object):
""" This class handles the tracking of preserved library objects """
def load(self):
""" Reload the registry data from file """
try:
- self._data = cPickle.load(open(self._filename, "r"))
+ self._data = pickle.load(open(self._filename, "r"))
except (EOFError, IOError), e:
if isinstance(e, EOFError) or e.errno == errno.ENOENT:
self._data = {}
return
try:
f = atomic_ofstream(self._filename)
- cPickle.dump(self._data, f)
+ pickle.dump(self._data, f)
f.close()
except EnvironmentError, e:
if e.errno != PermissionDenied.errno:
del self._aux_cache["modified"]
try:
f = atomic_ofstream(self._aux_cache_filename)
- cPickle.dump(self._aux_cache, f, -1)
+ pickle.dump(self._aux_cache, f, -1)
f.close()
apply_secpass_permissions(
self._aux_cache_filename, gid=portage_gid, mode=0644)
aux_cache = None
try:
f = open(self._aux_cache_filename)
- mypickle = cPickle.Unpickler(f)
+ mypickle = pickle.Unpickler(f)
mypickle.find_global = None
aux_cache = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, cPickle.UnpicklingError), e:
- if isinstance(e, cPickle.UnpicklingError):
+ except (IOError, OSError, EOFError, pickle.UnpicklingError), e:
+ if isinstance(e, pickle.UnpicklingError):
writemsg("!!! Error loading '%s': %s\n" % \
(self._aux_cache_filename, str(e)), noiselevel=-1)
del e
import urllib2
try:
- import cPickle
+ import cPickle as pickle
except ImportError:
- import pickle as cPickle
+ import pickle
try:
import ftplib
out = sys.stdout
try:
metadatafile = open("/var/cache/edb/remote_metadata.pickle")
- metadata = cPickle.load(metadatafile)
+ metadata = pickle.load(metadatafile)
out.write("Loaded metadata pickle.\n")
out.flush()
metadatafile.close()
- except (cPickle.UnpicklingError, OSError, IOError, EOFError):
+ except (pickle.UnpicklingError, OSError, IOError, EOFError):
metadata = {}
if baseurl not in metadata:
metadata[baseurl]={}
sys.stderr.flush()
mytempfile.close()
try:
- metadata[baseurl]["data"] = cPickle.loads(data)
+ metadata[baseurl]["data"] = pickle.loads(data)
del data
metadata[baseurl]["indexname"] = mfile
metadata[baseurl]["timestamp"] = int(time.time())
sys.stderr.flush()
try:
metadatafile = open("/var/cache/edb/remote_metadata.pickle", "w+")
- cPickle.dump(metadata,metadatafile)
+ pickle.dump(metadata,metadatafile)
metadatafile.close()
except SystemExit, e:
raise
if "modified" in metadata[baseurl] and metadata[baseurl]["modified"]:
metadata[baseurl]["timestamp"] = int(time.time())
metadatafile = open("/var/cache/edb/remote_metadata.pickle", "w+")
- cPickle.dump(metadata,metadatafile)
+ pickle.dump(metadata,metadatafile)
metadatafile.close()
if makepickle:
metadatafile = open(makepickle, "w")
- cPickle.dump(metadata[baseurl]["data"],metadatafile)
+ pickle.dump(metadata[baseurl]["data"],metadatafile)
metadatafile.close()
except SystemExit, e:
raise
from portage.dep import isvalidatom
try:
- import cPickle
+ import cPickle as pickle
except ImportError:
- import pickle as cPickle
+ import pickle
try:
import cStringIO as StringIO
import os
try:
myf=open(filename,"w")
- cPickle.dump(data,myf,-1)
+ pickle.dump(data,myf,-1)
myf.flush()
myf.close()
writemsg("Wrote pickle: "+str(filename)+"\n",1)
data = None
try:
myf = open(filename)
- mypickle = cPickle.Unpickler(myf)
+ mypickle = pickle.Unpickler(myf)
mypickle.find_global = None
data = mypickle.load()
myf.close()