gst/parse/gen_grammar.py.in
raw| 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | import subprocess, sys, shlex |
| 4 | |
| 5 | cfile = sys.argv[1] |
| 6 | hfile = sys.argv[2] |
| 7 | yfile = sys.argv[3] |
| 8 | |
| 9 | args = ['-d', '-v', '-ppriv_gst_parse_yy', yfile, '-o', cfile] |
| 10 | bison = [r'@BISON@'] + shlex.split(r'@BISON_ARGS@') |
| 11 | subprocess.check_call(bison + args) |
| 12 | |
| 13 | prefix = ''' |
| 14 | #ifdef HAVE_CONFIG_H |
| 15 | #include<config.h> |
| 16 | #endif |
| 17 | ''' |
| 18 | |
| 19 | contents = open(cfile).read() |
| 20 | content = prefix + contents |
| 21 | open(cfile, 'w').write(contents) |