WHATSNEW.txt: disable SMB1 by default!
[Samba.git] / third_party / wscript
blob286e1015e7067a2780351a2c51076f98c07b5928
1 #!/usr/bin/env python
3 import os
4 import sys
5 import samba_git
6 from waflib import Options, Errors
8 # work out what python external libraries we need to install
9 external_pkgs = {
10 "iso8601": "pyiso8601/iso8601",
14 def find_third_party_module(conf, module, package):
15 conf.COMPOUND_START("Checking for third party Python module %s" % module)
16 try:
17 __import__(module)
18 except ImportError:
19 pass
20 else:
21 # Installed on the system
22 conf.COMPOUND_END("system")
24 old_path = sys.path
25 try:
26 sys.path.append(os.path.join(conf.path.abspath(), os.path.dirname(package)))
27 try:
28 __import__(module)
29 except ImportError:
30 if samba_git.has_submodules(conf.srcnode.abspath()):
31 raise Errors.WafError("""\
32 Unable to find Python module '%s'. Please install the system package or check \
33 out the relevant submodule by running 'git submodule update --init'.
34 """ % module)
35 else:
36 raise Errors.WafError("""\
37 Unable to find Python module '%s'. Please install the system package or place a copy in
38 %s.
39 """ % (module, package))
40 else:
41 conf.COMPOUND_END("bundled")
42 finally:
43 sys.path = old_path
46 def configure(conf):
47 for module, package in external_pkgs.items():
48 find_third_party_module(conf, module, package)
49 conf.RECURSE('cmocka')
50 conf.RECURSE('popt')
51 conf.RECURSE('zlib')
52 conf.RECURSE('aesni-intel')
53 if conf.CONFIG_GET('ENABLE_SELFTEST'):
54 conf.RECURSE('socket_wrapper')
55 conf.RECURSE('nss_wrapper')
56 conf.RECURSE('resolv_wrapper')
57 conf.RECURSE('uid_wrapper')
58 if Options.options.with_pam:
59 conf.RECURSE('pam_wrapper')
62 def build(bld):
63 if not bld.env.disable_python:
64 list = []
66 for module, package in external_pkgs.items():
67 try:
68 __import__(module)
69 except ImportError:
70 list.append(package)
72 for e in list:
73 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}/samba/third_party', e + '/**/*', flat=False,
74 exclude='*.pyc', trim_path=os.path.dirname(e))
76 bld.SAMBA_GENERATOR('third_party_init_py',
77 rule='touch ${TGT}',
78 target='empty_file')
80 bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/third_party', 'empty_file', destname='__init__.py')
82 bld.RECURSE('cmocka')
83 bld.RECURSE('zlib')
84 bld.RECURSE('popt')
85 bld.RECURSE('aesni-intel')
86 if bld.CONFIG_GET('SOCKET_WRAPPER'):
87 bld.RECURSE('socket_wrapper')
88 if bld.CONFIG_GET('NSS_WRAPPER'):
89 bld.RECURSE('nss_wrapper')
90 if bld.CONFIG_GET('RESOLV_WRAPPER'):
91 bld.RECURSE('resolv_wrapper')
92 if bld.CONFIG_GET('UID_WRAPPER'):
93 bld.RECURSE('uid_wrapper')
94 if bld.CONFIG_GET('PAM_WRAPPER'):
95 bld.RECURSE('pam_wrapper')