aboutsummaryrefslogtreecommitdiff
path: root/potpourri/ca-unpickle.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-04-27 22:20:19 +0000
committerRob Austein <sra@hactrn.net>2016-04-27 22:20:19 +0000
commit319916e90e1b1f6328effbc7cd9acf74c38c1842 (patch)
tree4914806f2603e40640b536f1d86dfb3e5b561a1b /potpourri/ca-unpickle.py
parent3503ee53e0ef4092a393a606c18a6b6b3e17e3a9 (diff)
First step of transition mechanism from trunk/ to tk705/: script to
encapsulate all (well, we hope) relevant configuration and state from a trunk/ CA in a form we can easily load on another machine, or on the same machine after a software upgrade, or .... Transfer format is an ad hoc Python dictionary, encoded in Python's native "Pickle" format, compressed by "xz" with SHA-256 integrity checking enabled. See #807. svn path=/trunk/; revision=6395
Diffstat (limited to 'potpourri/ca-unpickle.py')
-rwxr-xr-xpotpourri/ca-unpickle.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/potpourri/ca-unpickle.py b/potpourri/ca-unpickle.py
new file mode 100755
index 00000000..dbbe3e8a
--- /dev/null
+++ b/potpourri/ca-unpickle.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# $Id$
+
+"""
+Unpickle CA state packaged by ca-pickle.
+
+This version is a stub, and exists only to test ca-pickle.
+"""
+
+import sys
+import cPickle
+import argparse
+import subprocess
+
+parser = argparse.ArgumentParser(description = __doc__)
+parser.add_argument("input", help = "input file")
+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))
+
+print "import datetime"
+print "world =", repr(world)