[act] from shelve to pickle

parent a6d8bc01
......@@ -21,8 +21,9 @@
# * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
# ***************************************************************************
# import anydbm
import shelve
import pickle
from os import remove
from .configuration import cfg
......@@ -37,12 +38,12 @@ def parseCommandLine(current):
def getCurrent():
current = {}
current={}
try:
shlv = shelve.open(cfg.configFile, protocol=2,writeback=False)
with open(cfg.configFile, "rb") as fp:
shlv = pickle.load(fp)
except:
remove(cfg.configFile)
shlv = shelve.open(cfg.configFile, protocol=2,writeback=False)
shlv = {}
for key in cfg.default: # .iterkeys():
current[key] = cfg.default[key]
......@@ -54,11 +55,14 @@ def getCurrent():
def setCurrent(current):
shlv = shelve.open(cfg.configFile, protocol=2,writeback=True)
shlv = {}
for key in current.keys():
if key not in cfg.non_persistent:
shlv[key] = current[key]
with open(cfg.configFile, "wb") as fp:
pickle.dump(shlv, fp)
def checkCurrent(current, options, args):
# helper
......
......@@ -46,7 +46,7 @@ cfg.__version_minor="1"
cfg.__version = cfg.__version_major+"."+cfg.__version_minor
cfg.modulesFile = "src/modules.txt" # the file to parse to find the modules
cfg.configFile = ".options.act2_1.py" #
cfg.configFile = ".options.act2.pickle" #
cfg.fixedSeedValue = "10"
cfg.nbr_tests_for_stats = 20
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment