File: python-generator.py

package info (click to toggle)
xmms2 0.5DrLecter-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,988 kB
  • ctags: 11,272
  • sloc: ansic: 51,389; cpp: 26,556; python: 11,479; perl: 202; ruby: 138; makefile: 100; asm: 7; sh: 4
file content (25 lines) | stat: -rw-r--r-- 643 bytes parent folder | download
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
import Action
import Node
from Params import error
import sys

genpy_str = '${PYTHON} ${SRC} -> ${TGT}'

def genpy_file(self, node):
    gentask = self.create_task('genpy', nice=1)
    gentask.set_inputs([node, node.change_ext('.head.c')])
    gentask.set_outputs(node.change_ext('.c'))

    cctask = self.create_task('cc')
    cctask.set_inputs(gentask.m_outputs)
    cctask.set_outputs(node.change_ext('.o'))

def setup(env):
    Action.simple_action('genpy', genpy_str, color='BLUE')

    env.hook('cc', 'GENPY_EXT', genpy_file)

def detect(conf):
    conf.env['PYTHON'] = sys.executable
    conf.env['GENPY_EXT'] = ['.genpy']
    return 1