archrelease: copy trunk to community-any
[ArchLinux/community.git] / sage-data-conway_polynomials / trunk / spkg-install
blobe658a76b45e667b6fefea459f4bac857bf2e54a8
1 import os
2 import pickle
4 SAGE_SHARE = os.getenv('SAGE_SHARE')
5 install_root = os.path.join(SAGE_SHARE, 'conway_polynomials')
7 def create_db():
8     db = {}
9     from src import conway_polynomials
10     for p, n, v in conway_polynomials:
11         if not p in db:
12             db[p] = {}
13         db[p][n] = v
14     if not os.path.exists(install_root):
15         os.makedirs(install_root)
16     with open(os.path.join(install_root, 'conway_polynomials.p'), 'wb') as f:
17         pickle.dump(db, f)
19 if __name__ == '__main__':
20     create_db()