import zlib; comp = zlib
import cPickle
import os
import sys
sys.path.append('.')
from src import conway_polynomials

db = {}
for p,n,v in conway_polynomials:
    if not db.has_key(p):
        db[p] = {}
    db[p][n] = v

dstdir = os.path.join('build')
dst = os.path.join(dstdir, 'conway_polynomials.sobj')
if not os.path.exists(dstdir):
        os.makedirs(dstdir)

open(dst, 'wb').write(comp.compress(cPickle.dumps(db, protocol=2)))
