aboutsummaryrefslogtreecommitdiff
path: root/potpourri/ca-unpickle.py
blob: 5f255d8fcf62e14be2b7f08458fd4858bb63a48d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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(xzcat.returncode))

print "import datetime"
print "world =", repr(world)