summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_python.py
blob: e9fa88c6ecc4bfb764941334c0532d7b6f785869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# waf build tool for building IDL files with pidl

import Build
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,
                 vars=None,
                 enabled=True):
    '''build a python extension for Samba'''

    # 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:
        cflags += '-DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinal

    source = bld.EXPAND_VARIABLES(source, vars=vars)

    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)

    link_name = 'python/%s' % realname

    bld.SAMBA_LIBRARY(name,
                      source=source,
                      deps=deps,
                      public_deps=public_deps,
                      includes=includes,
                      cflags=cflags,
                      realname=realname,
                      local_include=local_include,
                      vars=vars,
                      link_name=link_name,
                      needs_python=True,
                      target_type='PYTHON',
                      install_path='${PYTHONDIR}',
                      enabled=enabled)

Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON