aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-04-28 01:25:09 +0000
committerRob Austein <sra@hactrn.net>2016-04-28 01:25:09 +0000
commitfe2f853e7bec8d6966b6f8ee59c177c4606a30da (patch)
treecaa3806c01471b2bbfbe0ab2ae26b892c88aa82d
parentbdc3a6ef48a3ebbd44b4f51d274a21b24aac8eb9 (diff)
Pull ca-{pickle,unpickle}.py updates from trunk/.
svn path=/branches/tk705/; revision=6398
-rwxr-xr-xpotpourri/ca-pickle.py13
-rwxr-xr-xpotpourri/ca-unpickle.py2
2 files changed, 8 insertions, 7 deletions
diff --git a/potpourri/ca-pickle.py b/potpourri/ca-pickle.py
index 92741853..2c63e978 100755
--- a/potpourri/ca-pickle.py
+++ b/potpourri/ca-pickle.py
@@ -55,15 +55,15 @@ for section in ("rpkid", "irdbd", "pubd"):
databases[section] = tables
filenames = [cfg.filename]
-raw_config = {}
-cooked_config = {}
+raw_config = dict((section, {}) for section in cfg.cfg.sections())
+cooked_config = dict((section, {}) for section in cfg.cfg.sections())
for section in cfg.cfg.sections():
for option in cfg.cfg.options(section):
- raw_config[section, option] = cfg.cfg.get(section = section, option = option)
- cooked_config[section, option] = cfg.get(section = section, option = option)
- if os.path.isfile(cooked_config[section, option]):
- filenames.append(cooked_config[section, option])
+ raw_config [section][option] = cfg.cfg.get(section = section, option = option)
+ cooked_config[section][option] = cfg.get(section = section, option = option)
+ if os.path.isfile( cooked_config[section][option]):
+ filenames.append(cooked_config[section][option])
for i, fn in enumerate(filenames):
filenames[i] = os.path.abspath(fn)
@@ -89,6 +89,7 @@ xz = subprocess.Popen(
cPickle.dump(world, xz.stdin, args.protocol)
+xz.stdin.flush()
xz.stdin.close()
if xz.wait() != 0:
diff --git a/potpourri/ca-unpickle.py b/potpourri/ca-unpickle.py
index dbbe3e8a..5f255d8f 100755
--- a/potpourri/ca-unpickle.py
+++ b/potpourri/ca-unpickle.py
@@ -20,7 +20,7 @@ args = parser.parse_args()
xzcat = subprocess.Popen(("xzcat", args.input), stdout = subprocess.PIPE)
world = cPickle.load(xzcat.stdout)
if xzcat.wait() != 0:
- sys.exit("XZ unpickling failed with code {}".format(xz.returncode))
+ sys.exit("XZ unpickling failed with code {}".format(xzcat.returncode))
print "import datetime"
print "world =", repr(world)