blob: ffd90318ea302703a032fc4f3927aade075c0c1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import getopt
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:I:x', [])
output = None
opt_string = ''
i_arguments = ''
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
elif opt == '-I': i_arguments = i_arguments + ' ' + arg
else: opt_string = opt_string + ' ' + opt
for a in args:
contents = open(a, 'rb').read()
contents = contents.replace(b'YACCFLAGS', opt_string.encode())
contents = contents.replace(b'I_ARGS', i_arguments.encode())
output.write(contents)
output.close()
sys.exit(0)
|