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