2015-03-28 18:43:29 +03:00
#!/usr/bin/env python
2015-05-18 23:19:23 +03:00
import samba_git
2017-11-24 15:34:25 +03:00
import Options
2015-03-28 19:11:51 +03:00
import Utils
2015-03-28 18:43:29 +03:00
import os
2015-03-28 19:11:51 +03:00
import sys
2015-03-28 18:43:29 +03:00
# work out what python external libraries we need to install
2015-03-28 19:11:51 +03:00
external_pkgs = {
2015-03-28 18:43:29 +03:00
"dns.resolver": "dnspython/dns",
"iso8601": "pyiso8601/iso8601",
}
2015-03-28 19:11:51 +03:00
def find_third_party_module(conf, module, package):
conf.COMPOUND_START("Checking for third party Python module %s" % module)
try:
__import__(module)
except ImportError:
pass
else:
# Installed on the system
conf.COMPOUND_END("system")
old_path = sys.path
try:
sys.path.append(os.path.join(conf.curdir, os.path.dirname(package)))
try:
__import__(module)
except ImportError:
2015-05-18 23:19:23 +03:00
if samba_git.has_submodules(conf.srcdir):
2015-03-28 19:11:51 +03:00
raise Utils.WafError("""\
Unable to find Python module '%s'. Please install the system package or check \
2015-05-06 01:05:14 +03:00
out the relevant submodule by running 'git submodule update --init'.
2015-03-28 19:11:51 +03:00
""" % module)
else:
raise Utils.WafError("""\
Unable to find Python module '%s'. Please install the system package or place a copy in
%s.
""" % (module, package))
else:
conf.COMPOUND_END("bundled")
finally:
sys.path = old_path
2015-03-28 18:43:29 +03:00
def configure(conf):
2015-03-28 19:11:51 +03:00
for module, package in external_pkgs.items():
find_third_party_module(conf, module, package)
2017-04-07 16:44:05 +03:00
conf.RECURSE('cmocka')
2015-03-28 18:43:29 +03:00
conf.RECURSE('popt')
conf.RECURSE('zlib')
2017-09-06 19:58:06 +03:00
conf.RECURSE('aesni-intel')
2017-11-07 12:51:11 +03:00
if conf.CONFIG_GET('ENABLE_SELFTEST'):
conf.RECURSE('socket_wrapper')
2017-11-07 13:40:11 +03:00
conf.RECURSE('nss_wrapper')
2017-11-07 13:55:04 +03:00
conf.RECURSE('resolv_wrapper')
2017-11-07 14:02:19 +03:00
conf.RECURSE('uid_wrapper')
2017-11-24 15:34:25 +03:00
if Options.options.with_pam:
conf.RECURSE('pam_wrapper')
2015-03-28 18:43:29 +03:00
def build(bld):
list = []
2015-03-28 19:11:51 +03:00
for module, package in external_pkgs.items():
2015-03-28 18:43:29 +03:00
try:
__import__(module)
except ImportError:
list.append(package)
for e in list:
bld.INSTALL_WILDCARD('${PYTHONARCHDIR}/samba/third_party', e + '/**/*', flat=False,
exclude='*.pyc', trim_path=os.path.dirname(e))
bld.SAMBA_GENERATOR('third_party_init_py',
rule='touch ${TGT}',
target='empty_file')
bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/third_party', 'empty_file', destname='__init__.py')
2017-04-07 16:44:05 +03:00
bld.RECURSE('cmocka')
2015-03-28 18:43:29 +03:00
bld.RECURSE('zlib')
bld.RECURSE('popt')
2017-09-06 19:58:06 +03:00
bld.RECURSE('aesni-intel')
2017-11-07 12:51:11 +03:00
if bld.CONFIG_GET('SOCKET_WRAPPER'):
bld.RECURSE('socket_wrapper')
2017-11-07 13:40:11 +03:00
if bld.CONFIG_GET('NSS_WRAPPER'):
bld.RECURSE('nss_wrapper')
2017-11-07 13:55:04 +03:00
if bld.CONFIG_GET('RESOLV_WRAPPER'):
bld.RECURSE('resolv_wrapper')
2017-11-07 14:02:19 +03:00
if bld.CONFIG_GET('UID_WRAPPER'):
bld.RECURSE('uid_wrapper')
2017-11-24 15:34:25 +03:00
if bld.CONFIG_GET('PAM_WRAPPER'):
bld.RECURSE('pam_wrapper')