waf: Fix mispelling
[nivanova/samba-autobuild/.git] / buildtools / wafsamba / samba_python.py
1 # waf build tool for building IDL files with pidl
2
3 import Build
4 from samba_utils import *
5 from samba_autoconf import *
6
7 from Configure import conf
8 @conf
9 def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
10     if conf.env["python_headers_checked"] == []:
11         conf.check_python_headers(mandatory)
12         conf.env["python_headers_checked"] = "yes"
13     else:
14         conf.msg("python headers", "using cache")
15
16
17 def SAMBA_PYTHON(bld, name,
18                  source='',
19                  deps='',
20                  public_deps='',
21                  realname=None,
22                  cflags='',
23                  includes='',
24                  init_function_sentinel=None,
25                  local_include=True,
26                  vars=None,
27                  enabled=True):
28     '''build a python extension for Samba'''
29
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_sentinel is not None:
33         cflags += '-DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinel
34
35     source = bld.EXPAND_VARIABLES(source, vars=vars)
36
37     if realname is not None:
38         link_name = 'python/%s' % realname
39     else:
40         link_name = None
41
42     bld.SAMBA_LIBRARY(name,
43                       source=source,
44                       deps=deps,
45                       public_deps=public_deps,
46                       includes=includes,
47                       cflags=cflags,
48                       local_include=local_include,
49                       vars=vars,
50                       realname=realname,
51                       link_name=link_name,
52                       pyext=True,
53                       target_type='PYTHON',
54                       install_path='${PYTHONARCHDIR}',
55                       allow_undefined_symbols=True,
56                       enabled=enabled)
57
58 Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON