vfs_fileid: Fix the 32-bit build
[Samba.git] / third_party / wscript
blob9a86dfe44e3aedc896f8714240f576b1f83ec5b2
1 #!/usr/bin/env python
3 import samba_git
4 import Options
5 import Utils
6 import os
7 import sys
9 # work out what python external libraries we need to install
10 external_pkgs = {
11 "dns.resolver": "dnspython/dns",
12 "iso8601": "pyiso8601/iso8601",
16 def find_third_party_module(conf, module, package):
17 conf.COMPOUND_START("Checking for third party Python module %s" % module)
18 try:
19 __import__(module)
20 except ImportError:
21 pass
22 else:
23 # Installed on the system
24 conf.COMPOUND_END("system")
26 old_path = sys.path
27 try:
28 sys.path.append(os.path.join(conf.curdir, os.path.dirname(package)))
29 try:
30 __import__(module)
31 except ImportError:
32 if samba_git.has_submodules(conf.srcdir):
33 raise Utils.WafError("""\
34 Unable to find Python module '%s'. Please install the system package or check \
35 out the relevant submodule by running 'git submodule update --init'.
36 """ % module)
37 else:
38 raise Utils.WafError("""\
39 Unable to find Python module '%s'. Please install the system package or place a copy in
40 %s.
41 """ % (module, package))
42 else:
43 conf.COMPOUND_END("bundled")
44 finally:
45 sys.path = old_path
48 def configure(conf):
49 for module, package in external_pkgs.items():
50 find_third_party_module(conf, module, package)
51 conf.RECURSE('cmocka')
52 conf.RECURSE('popt')
53 conf.RECURSE('zlib')
54 conf.RECURSE('aesni-intel')
55 if conf.CONFIG_GET('ENABLE_SELFTEST'):
56 conf.RECURSE('socket_wrapper')
57 conf.RECURSE('nss_wrapper')
58 conf.RECURSE('resolv_wrapper')
59 conf.RECURSE('uid_wrapper')
60 if Options.options.with_pam:
61 conf.RECURSE('pam_wrapper')
64 def build(bld):
65 list = []
67 for module, package in external_pkgs.items():
68 try:
69 __import__(module)
70 except ImportError:
71 list.append(package)
73 for e in list:
74 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}/samba/third_party', e + '/**/*', flat=False,
75 exclude='*.pyc', trim_path=os.path.dirname(e))
77 bld.SAMBA_GENERATOR('third_party_init_py',
78 rule='touch ${TGT}',
79 target='empty_file')
81 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')