Include waf as an extracted source directory, rather than as a one-in-a-file script.
[samba.git] / buildtools / wafadmin / Tools / dbus.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Ali Sabil, 2007
4
5 import Task, Utils
6 from TaskGen import taskgen, before, after, feature
7
8 @taskgen
9 def add_dbus_file(self, filename, prefix, mode):
10         if not hasattr(self, 'dbus_lst'):
11                 self.dbus_lst = []
12         self.meths.append('process_dbus')
13         self.dbus_lst.append([filename, prefix, mode])
14
15 @before('apply_core')
16 def process_dbus(self):
17         for filename, prefix, mode in getattr(self, 'dbus_lst', []):
18                 node = self.path.find_resource(filename)
19
20                 if not node:
21                         raise Utils.WafError('file not found ' + filename)
22
23                 tsk = self.create_task('dbus_binding_tool', node, node.change_ext('.h'))
24
25                 tsk.env.DBUS_BINDING_TOOL_PREFIX = prefix
26                 tsk.env.DBUS_BINDING_TOOL_MODE   = mode
27
28 Task.simple_task_type('dbus_binding_tool',
29         '${DBUS_BINDING_TOOL} --prefix=${DBUS_BINDING_TOOL_PREFIX} --mode=${DBUS_BINDING_TOOL_MODE} --output=${TGT} ${SRC}',
30         color='BLUE', before='cc')
31
32 def detect(conf):
33         dbus_binding_tool = conf.find_program('dbus-binding-tool', var='DBUS_BINDING_TOOL')
34