2010-03-17 14:07:11 +03:00
# waf build tool for building IDL files with pidl
2010-03-17 12:12:16 +03:00
import Build
2010-03-17 14:07:11 +03:00
from samba_utils import *
from samba_autoconf import *
def SAMBA_PYTHON ( bld , name ,
source = ' ' ,
deps = ' ' ,
public_deps = ' ' ,
realname = None ,
cflags = ' ' ,
includes = ' ' ,
init_function_sentinal = None ,
local_include = True ,
2010-03-25 01:23:10 +03:00
vars = None ,
2010-03-17 14:07:11 +03:00
enabled = True ) :
''' build a python extension for Samba '''
2010-03-17 12:12:16 +03:00
# when we support static python modules we'll need to gather
# the list from all the SAMBA_PYTHON() targets
if init_function_sentinal is not None :
2010-03-17 07:22:18 +03:00
cflags + = ' -DSTATIC_LIBPYTHON_MODULES= %s ' % init_function_sentinal
2010-03-17 12:12:16 +03:00
2010-03-25 01:23:10 +03:00
source = bld . EXPAND_VARIABLES ( source , vars = vars )
2010-03-17 12:12:16 +03:00
if realname is None :
# a SAMBA_PYTHON target without a realname is just a
# subsystem with needs_python=True
return bld . SAMBA_SUBSYSTEM ( name ,
source = source ,
deps = deps ,
public_deps = public_deps ,
cflags = cflags ,
includes = includes ,
init_function_sentinal = init_function_sentinal ,
local_include = local_include ,
needs_python = True ,
enabled = enabled )
2010-03-17 14:07:11 +03:00
if not enabled :
SET_TARGET_TYPE ( bld , name , ' DISABLED ' )
return
if not SET_TARGET_TYPE ( bld , name , ' PYTHON ' ) :
return
deps + = ' ' + public_deps
2010-03-17 12:12:16 +03:00
if realname is None :
2010-03-18 15:48:09 +03:00
realname = ' %s .so ' % name
link_name = ' python/ %s ' % realname
2010-03-17 14:07:11 +03:00
t = bld (
2010-03-17 12:12:16 +03:00
features = ' cc cshlib pyext symlink_lib ' ,
2010-03-17 14:07:11 +03:00
source = source ,
target = name ,
2010-03-17 12:12:16 +03:00
samba_cflags = CURRENT_CFLAGS ( bld , name , cflags ) ,
2010-03-17 14:07:11 +03:00
samba_includes = includes ,
local_include = local_include ,
2010-03-17 12:12:16 +03:00
samba_deps = TO_LIST ( deps ) ,
2010-03-18 15:48:09 +03:00
link_name = link_name ,
name = name
2010-03-17 14:07:11 +03:00
)
Build . BuildContext . SAMBA_PYTHON = SAMBA_PYTHON