4 from waflib
import Options
, Errors
6 # work out what python external libraries we need to be successful
8 'iso8601': 'python3-iso8601',
9 'cryptography': 'python3-cryptography',
10 'pyasn1': 'python3-asn1'
14 'markdown': 'python3-markdown',
15 'dns': 'python3-dnspython (python3-dns on some systems)'
19 def find_third_party_module(conf
, module
, package
):
20 conf
.COMPOUND_START("Checking for system installation of Python module %s" % module
)
24 conf
.COMPOUND_END(False)
25 raise Errors
.WafError("""\
26 Unable to find Python module '%s'. Please install the system package: %s'.
27 """ % (module
, package
))
29 # Installed on the system
30 conf
.COMPOUND_END("system")
34 if conf
.env
.disable_python
:
37 kerberos_py
= conf
.srcnode
.abspath() + "/python/samba/provision/kerberos_implementation.py"
39 f
= open(kerberos_py
, 'w')
42 # Copyright (c) 2016 Andreas Schneider <asn@samba.org>
44 # This program is free software; you can redistribute it and/or modify
45 # it under the terms of the GNU General Public License as published by
46 # the Free Software Foundation; either version 3 of the License, or
47 # (at your option) any later version.
49 # This program is distributed in the hope that it will be useful,
50 # but WITHOUT ANY WARRANTY; without even the implied warranty of
51 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52 # GNU General Public License for more details.
54 # You should have received a copy of the GNU General Public License
55 # along with this program. If not, see <http://www.gnu.org/licenses/>.
60 data
= """kdb_modules_dir = "{0}"
63 if conf
.env
.HEIMDAL_KRB5_CONFIG
:
64 f
.write(data
.format("", ""))
66 modulesdir
= "%s/krb5/plugins/kdb" % conf
.env
.LIBDIR
68 f
.write(data
.format(modulesdir
))
72 if conf
.CONFIG_GET('ENABLE_SELFTEST'):
73 for module
, package
in selftest_pkgs
.items():
74 find_third_party_module(conf
, module
, package
)
76 if not Options
.options
.without_ad_dc
:
77 for module
, package
in ad_dc_pkgs
.items():
78 find_third_party_module(conf
, module
, package
)
84 pytalloc_util
= bld
.pyembed_libname('pytalloc-util')
85 pyparam_util
= bld
.pyembed_libname('pyparam_util')
86 libpython
= bld
.pyembed_libname('LIBPYTHON')
87 pyrpc_util
= bld
.pyembed_libname('pyrpc_util')
88 samba_python
= bld
.pyembed_libname('samba_python')
89 bld
.SAMBA_LIBRARY(samba_python
,
91 deps
='%s %s %s' % (libpython
, pytalloc_util
, pyrpc_util
),
92 grouping_library
=True,
95 enabled
=bld
.PYTHON_BUILD_IS_ENABLED())
96 bld
.SAMBA_PYTHON('python_glue',
103 ''' % (pyparam_util
, pytalloc_util
),
104 realname
='samba/_glue.so')
106 bld
.SAMBA_SUBSYSTEM(libpython
,
109 init_function_sentinel
='{NULL,NULL}',
112 enabled
=bld
.PYTHON_BUILD_IS_ENABLED())
114 if bld
.PYTHON_BUILD_IS_ENABLED():
115 # install out various python scripts for use by make test
116 bld
.SAMBA_SCRIPT('samba_python_files',
117 pattern
='samba/**/*.py',
120 bld
.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'samba/**/*.py', flat
=False)