build: separate out dependencies and python rules
[Samba/gebeck_regimport.git] / buildtools / wafsamba / samba_python.py
blob0845a7e61c562e1e6bde31df4457f50c2546573b
1 # waf build tool for building IDL files with pidl
3 from TaskGen import taskgen, before
4 import Build, os, string, Utils
5 from samba_utils import *
6 from samba_autoconf import *
9 def SAMBA_PYTHON(bld, name,
10 source='',
11 deps='',
12 public_deps='',
13 realname=None,
14 cflags='',
15 includes='',
16 init_function_sentinal=None,
17 local_include=True,
18 enabled=True):
19 '''build a python extension for Samba'''
21 if not enabled:
22 SET_TARGET_TYPE(bld, name, 'DISABLED')
23 return
25 if not SET_TARGET_TYPE(bld, name, 'PYTHON'):
26 return
28 deps += ' ' + public_deps
30 # when we support static python modules we'll need to gather
31 # the list from all the SAMBA_PYTHON() targets
32 if init_function_sentinal is not None:
33 cflags += '-DSTATIC_LIBPYTHON_MODULES="%s"' % init_function_sentinal
35 t = bld(
36 features = 'cc cshlib pyext',
37 source = source,
38 target = name,
39 ccflags = CURRENT_CFLAGS(bld, name, cflags),
40 samba_includes = includes,
41 local_include = local_include,
42 samba_deps = TO_LIST(deps)
44 Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON