build: Remove bld.gen_python_environments()
[bbaumbach/samba-autobuild/.git] / python / wscript
1 #!/usr/bin/env python
2
3 import os
4
5 def configure(conf):
6     if conf.env.disable_python:
7         return
8
9     kerberos_py = conf.srcnode.abspath() + "/python/samba/provision/kerberos_implementation.py"
10
11     f = open(kerberos_py, 'w')
12     try:
13         header = """#
14 # Copyright (c) 2016      Andreas Schneider <asn@samba.org>
15 #
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 3 of the License, or
19 # (at your option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 # GNU General Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License
27 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
28 #
29 """
30         f.write(header)
31
32         data = """kdb_modules_dir = "{0}"
33 """
34
35         if conf.env.HEIMDAL_KRB5_CONFIG:
36             f.write(data.format("", ""))
37         else:
38             modulesdir = "%s/krb5/plugins/kdb" % conf.env.LIBDIR
39
40             f.write(data.format(modulesdir))
41     finally:
42         f.close()
43
44 def build(bld):
45
46
47     pytalloc_util = bld.pyembed_libname('pytalloc-util')
48     pyparam_util = bld.pyembed_libname('pyparam_util')
49     libpython = bld.pyembed_libname('LIBPYTHON')
50     pyrpc_util = bld.pyembed_libname('pyrpc_util')
51     samba_python = bld.pyembed_libname('samba_python')
52     bld.SAMBA_LIBRARY(samba_python,
53                       source=[],
54                       deps='%s %s %s' % (libpython, pytalloc_util, pyrpc_util),
55                       grouping_library=True,
56                       private_library=True,
57                       pyembed=True,
58                       enabled=bld.PYTHON_BUILD_IS_ENABLED())
59     bld.SAMBA_PYTHON('python_glue',
60                      source='pyglue.c',
61                      deps='''
62                               %s
63                               samba-util
64                               netif
65                               %s
66                               ''' % (pyparam_util, pytalloc_util),
67                      realname='samba/_glue.so')
68
69     bld.SAMBA_SUBSYSTEM(libpython,
70                         source='modules.c',
71                         public_deps='',
72                         init_function_sentinel='{NULL,NULL}',
73                         deps='talloc',
74                         pyext=True,
75                         enabled=bld.PYTHON_BUILD_IS_ENABLED())
76
77     if bld.PYTHON_BUILD_IS_ENABLED():
78         # install out various python scripts for use by make test
79         bld.SAMBA_SCRIPT('samba_python_files',
80                          pattern='samba/**/*.py',
81                          installdir='python')
82         
83         bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'samba/**/*.py', flat=False)