File: bison.py

package info (click to toggle)
pyinstaller 6.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,824 kB
  • sloc: python: 41,828; ansic: 12,123; makefile: 171; sh: 131; xml: 19
file content (34 lines) | stat: -rw-r--r-- 933 bytes parent folder | download | duplicates (3)
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
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file

from waflib import Task
from waflib.TaskGen import extension


class bison(Task.Task):
    color = 'BLUE'
    run_str = '${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}'
    ext_out = ['.h']


@extension('.y', '.yc', '.yy')
def big_bison(self, node):
    has_h = '-d' in self.env.BISONFLAGS
    outs = []
    if node.name.endswith('.yc'):
        outs.append(node.change_ext('.tab.cc'))
        if has_h:
            outs.append(node.change_ext('.tab.hh'))
    else:
        outs.append(node.change_ext('.tab.c'))
        if has_h:
            outs.append(node.change_ext('.tab.h'))
    tsk = self.create_task('bison', node, outs)
    tsk.cwd = node.parent.get_bld()
    self.source.append(outs[0])


def configure(conf):
    conf.find_program('bison', var='BISON')
    conf.env.BISONFLAGS = ['-d']