4 from waflib
import Options
, Errors
6 # work out what python external libraries we need to be successful
8 'cryptography': 'python3-cryptography',
9 'pyasn1': 'python3-pyasn1'
13 'markdown': 'python3-markdown',
14 'dns': 'python3-dnspython (python3-dns on some systems)'
18 def find_third_party_module(conf
, module
, package
, required
=True):
19 conf
.COMPOUND_START("Checking for system installation of Python module %s" % module
)
23 conf
.COMPOUND_END(False)
26 raise Errors
.WafError("""\
27 Unable to find Python module '%s'. Please install the system package: %s'.
28 """ % (module
, package
))
30 # Installed on the system
31 conf
.COMPOUND_END("system")
37 if conf
.env
.disable_python
:
40 kerberos_py
= conf
.srcnode
.abspath() + "/python/samba/provision/kerberos_implementation.py"
42 f
= open(kerberos_py
, 'w')
45 # Copyright (c) 2016 Andreas Schneider <asn@samba.org>
47 # This program is free software; you can redistribute it and/or modify
48 # it under the terms of the GNU General Public License as published by
49 # the Free Software Foundation; either version 3 of the License, or
50 # (at your option) any later version.
52 # This program is distributed in the hope that it will be useful,
53 # but WITHOUT ANY WARRANTY; without even the implied warranty of
54 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55 # GNU General Public License for more details.
57 # You should have received a copy of the GNU General Public License
58 # along with this program. If not, see <http://www.gnu.org/licenses/>.
63 data
= """kdb_modules_dir = "{0}"
66 if conf
.env
.HEIMDAL_KRB5_CONFIG
:
67 f
.write(data
.format(""))
69 modulesdir
= "%s/krb5/plugins/kdb" % conf
.env
.LIBDIR
71 f
.write(data
.format(modulesdir
))
75 if conf
.CONFIG_GET('ENABLE_SELFTEST'):
76 for module
, package
in selftest_pkgs
.items():
77 find_third_party_module(conf
, module
, package
)
79 # Prefer dateutil.parser which is much more widely used.
80 if not find_third_party_module(conf
,
84 if not find_third_party_module(conf
,
88 raise Errors
.WafError("Could not find Python package "
89 "'python3-dateutils' nor "
90 "'python3-iso8601'. Please install "
91 "one of the packages.")
93 if not Options
.options
.without_ad_dc
:
94 for module
, package
in ad_dc_pkgs
.items():
95 find_third_party_module(conf
, module
, package
)
101 pytalloc_util
= bld
.pyembed_libname('pytalloc-util')
102 pyparam_util
= bld
.pyembed_libname('pyparam_util')
103 libpython
= bld
.pyembed_libname('LIBPYTHON')
104 pyrpc_util
= bld
.pyembed_libname('pyrpc_util')
105 samba_python
= bld
.pyembed_libname('samba_python')
106 bld
.SAMBA_LIBRARY(samba_python
,
108 deps
='%s %s %s' % (libpython
, pytalloc_util
, pyrpc_util
),
109 grouping_library
=True,
110 private_library
=True,
112 enabled
=bld
.PYTHON_BUILD_IS_ENABLED())
113 bld
.SAMBA_PYTHON('python_glue',
121 ''' % (pyparam_util
, pytalloc_util
),
122 realname
='samba/_glue.so')
124 bld
.SAMBA_SUBSYSTEM(libpython
,
127 init_function_sentinel
='{NULL,NULL}',
130 enabled
=bld
.PYTHON_BUILD_IS_ENABLED())
132 if bld
.PYTHON_BUILD_IS_ENABLED():
133 # install out various python scripts for use by make test
134 bld
.SAMBA_SCRIPT('samba_python_files',
135 pattern
='samba/**/*.py',
138 bld
.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'samba/**/*.py', flat
=False)