drepl_server: Allow refresh of partitions on UpdateRef
[Samba.git] / third_party / wscript
blobad4d6245bbd429820719cac1ce935d1c0d69eb8f
1 #!/usr/bin/env python
3 import samba_git
4 import Utils
5 import os
6 import sys
8 # work out what python external libraries we need to install
9 external_pkgs = {
10 "dns.resolver": "dnspython/dns",
11 "iso8601": "pyiso8601/iso8601",
15 def find_third_party_module(conf, module, package):
16 conf.COMPOUND_START("Checking for third party Python module %s" % module)
17 try:
18 __import__(module)
19 except ImportError:
20 pass
21 else:
22 # Installed on the system
23 conf.COMPOUND_END("system")
25 old_path = sys.path
26 try:
27 sys.path.append(os.path.join(conf.curdir, os.path.dirname(package)))
28 try:
29 __import__(module)
30 except ImportError:
31 if samba_git.has_submodules(conf.srcdir):
32 raise Utils.WafError("""\
33 Unable to find Python module '%s'. Please install the system package or check \
34 out the relevant submodule by running 'git submodule update --init'.
35 """ % module)
36 else:
37 raise Utils.WafError("""\
38 Unable to find Python module '%s'. Please install the system package or place a copy in
39 %s.
40 """ % (module, package))
41 else:
42 conf.COMPOUND_END("bundled")
43 finally:
44 sys.path = old_path
47 def configure(conf):
48 for module, package in external_pkgs.items():
49 find_third_party_module(conf, module, package)
50 conf.RECURSE('cmocka')
51 conf.RECURSE('popt')
52 conf.RECURSE('zlib')
55 def build(bld):
56 list = []
58 for module, package in external_pkgs.items():
59 try:
60 __import__(module)
61 except ImportError:
62 list.append(package)
64 for e in list:
65 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}/samba/third_party', e + '/**/*', flat=False,
66 exclude='*.pyc', trim_path=os.path.dirname(e))
68 bld.SAMBA_GENERATOR('third_party_init_py',
69 rule='touch ${TGT}',
70 target='empty_file')
72 bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/third_party', 'empty_file', destname='__init__.py')
73 bld.RECURSE('cmocka')
74 bld.RECURSE('zlib')
75 bld.RECURSE('popt')