-
Notifications
You must be signed in to change notification settings - Fork 4
/
dbExpand
executable file
·42 lines (31 loc) · 975 Bytes
/
dbExpand
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012 Brookhaven Science Associates, as Operator of
Brookhaven National Laboratory.
pyPDB is distributed subject to a Software License Agreement found
in file LICENSE that is included with this distribution.
"""
from optparse import OptionParser
from pyPDB.dbd.expand import loadDBD
from pyPDB.dbd.show import showDBD
parser = OptionParser()
parser.add_option("-I", dest='include', action='append', default=[],
help='Add to search path', metavar='PATH')
parser.add_option("-o", '--output',
help='Output file', metavar='FILE')
opts, args = parser.parse_args()
if opts.output is None:
import sys
out=sys.stdout
else:
out=file(opts.output, 'w')
dbd=[]
#from dbd import grammer
#grammer.Record.setDebug(True)
pcache={}
for inp in args:
dbd+=loadDBD(inp, path=opts.include, cache=pcache)
showDBD(dbd, out)
if opts.output is not None:
out.close()