1 # waf build tool for building IDL files with pidl
4 from samba_utils
import *
5 from samba_autoconf
import *
7 from Configure
import conf
10 def SAMBA_CHECK_PYTHON(conf
, mandatory
=True, version
=(2,4,2)):
11 # enable tool to build python extensions
12 conf
.find_program('python', var
='PYTHON', mandatory
=mandatory
)
13 conf
.check_tool('python')
14 path_python
= conf
.find_program('python')
15 conf
.env
.PYTHON_SPECIFIED
= (conf
.env
.PYTHON
!= path_python
)
16 conf
.check_python_version(version
)
19 def SAMBA_CHECK_PYTHON_HEADERS(conf
, mandatory
=True):
20 if conf
.env
["python_headers_checked"] == []:
21 conf
.check_python_headers(mandatory
)
22 conf
.env
["python_headers_checked"] = "yes"
24 conf
.msg("python headers", "using cache")
27 def SAMBA_PYTHON(bld
, name
,
34 init_function_sentinel
=None,
38 '''build a python extension for Samba'''
40 # when we support static python modules we'll need to gather
41 # the list from all the SAMBA_PYTHON() targets
42 if init_function_sentinel
is not None:
43 cflags
+= '-DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinel
45 source
= bld
.EXPAND_VARIABLES(source
, vars=vars)
47 if realname
is not None:
48 link_name
= 'python_modules/%s' % realname
52 bld
.SAMBA_LIBRARY(name
,
55 public_deps
=public_deps
,
58 local_include
=local_include
,
64 install_path
='${PYTHONARCHDIR}',
65 allow_undefined_symbols
=True,
68 Build
.BuildContext
.SAMBA_PYTHON
= SAMBA_PYTHON