| 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_sentinal=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_sentinal is not None:
|
|---|
| 33 | cflags += '-DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinal
|
|---|
| 34 |
|
|---|
| 35 | source = bld.EXPAND_VARIABLES(source, vars=vars)
|
|---|
| 36 |
|
|---|
| 37 | if realname is None:
|
|---|
| 38 | # a SAMBA_PYTHON target without a realname is just a
|
|---|
| 39 | # library with pyembed=True
|
|---|
| 40 | bld.SAMBA_LIBRARY(name,
|
|---|
| 41 | source=source,
|
|---|
| 42 | deps=deps,
|
|---|
| 43 | public_deps=public_deps,
|
|---|
| 44 | includes=includes,
|
|---|
| 45 | cflags=cflags,
|
|---|
| 46 | local_include=local_include,
|
|---|
| 47 | vars=vars,
|
|---|
| 48 | pyembed=True,
|
|---|
| 49 | enabled=enabled)
|
|---|
| 50 | return
|
|---|
| 51 |
|
|---|
| 52 | link_name = 'python/%s' % realname
|
|---|
| 53 |
|
|---|
| 54 | bld.SAMBA_LIBRARY(name,
|
|---|
| 55 | source=source,
|
|---|
| 56 | deps=deps,
|
|---|
| 57 | public_deps=public_deps,
|
|---|
| 58 | includes=includes,
|
|---|
| 59 | cflags=cflags,
|
|---|
| 60 | realname=realname,
|
|---|
| 61 | local_include=local_include,
|
|---|
| 62 | vars=vars,
|
|---|
| 63 | link_name=link_name,
|
|---|
| 64 | pyembed=True,
|
|---|
| 65 | target_type='PYTHON',
|
|---|
| 66 | install_path='${PYTHONARCHDIR}',
|
|---|
| 67 | enabled=enabled)
|
|---|
| 68 |
|
|---|
| 69 | Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
|
|---|