cPickle import protection; fall back to pickle if cPickle is unavailable.
authorBrian Harring <ferringb@gentoo.org>
Wed, 8 Feb 2006 17:51:52 +0000 (17:51 -0000)
committerBrian Harring <ferringb@gentoo.org>
Wed, 8 Feb 2006 17:51:52 +0000 (17:51 -0000)
svn path=/main/trunk/; revision=2679

pym/getbinpkg.py
pym/portage.py
pym/portage_util.py

index ccffc1dd2a7a97104d8a95e1bd48770774fdf8f6..d9c9810f59430d5b0bbb1b03e895db1634e75a77 100644 (file)
@@ -5,7 +5,12 @@
 
 
 from output import *
-import htmllib,HTMLParser,string,formatter,sys,os,xpak,time,tempfile,cPickle,base64
+import htmllib,HTMLParser,string,formatter,sys,os,xpak,time,tempfile,base64
+
+try:
+       import cPickle
+except ImportError:
+       import pickle as cPickle
 
 try:
        import ftplib
index 0849841ae0ec9ef01e2b618993a3f0d182735844..0018ab9145bbcb09a4b0e8b10d1cc186022bf26a 100644 (file)
@@ -20,9 +20,13 @@ except:
 
 try:
        import os,string,types,signal,fcntl
-       import time,cPickle,traceback,copy
+       import time,traceback,copy
        import re,pwd,grp,commands
        import shlex,shutil
+       try:
+               import cPickle
+       except ImportError:
+               import pickle as cPickle
 
        import stat
        import commands
index ef155b5dbea69c260f5cbe7d3f80df6f69ae457d..ddb1426ad6c1f57e5e987a085f7786134c1ed351 100644 (file)
@@ -4,6 +4,11 @@
 
 
 import sys,string,shlex,os.path
+try:
+       import cPickle
+except ImportError:
+       import pickle as cPickle
+
 if not hasattr(__builtins__, "set"):
        from sets import Set as set
 
@@ -365,7 +370,7 @@ def varexpand(mystring,mydict={}):
        return newstring[1:]    
 
 def pickle_write(data,filename,debug=0):
-       import cPickle,os
+       import os
        try:
                myf=open(filename,"w")
                cPickle.dump(data,myf,-1)
@@ -381,7 +386,7 @@ def pickle_write(data,filename,debug=0):
        return 1
 
 def pickle_read(filename,default=None,debug=0):
-       import cPickle,os
+       import os
        if not os.access(filename, os.R_OK):
                writemsg("pickle_read(): File not readable. '"+filename+"'\n",1)
                return default