summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2015-03-28 16:11:51 +0000
committerDavid Disseldorp <ddiss@samba.org>2015-03-30 13:40:33 +0200
commitc3747f9658fe1365a140622d3e12823dad7cb39e (patch)
tree0dd91769e7a0dfc7e306161de61ef9af398bcb1d /third_party
parente50342f33d5969f34e5b83f1ed3e7644470fb2ce (diff)
downloadsamba-c3747f9658fe1365a140622d3e12823dad7cb39e.tar.gz
Check for third party Python modules during configure.
Inform the user whether the module was found on the system, or if the bundled copy is being used. If the module is not found, suggest what they can do to make it available to Samba. Change-Id: I89ec57a2acf87768ca3714add59575578d2ee399 Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Mon Mar 30 13:40:33 CEST 2015 on sn-devel-104
Diffstat (limited to 'third_party')
-rw-r--r--third_party/wscript41
1 files changed, 39 insertions, 2 deletions
diff --git a/third_party/wscript b/third_party/wscript
index 8e7581f1e6c..4f6347795eb 100644
--- a/third_party/wscript
+++ b/third_party/wscript
@@ -1,15 +1,52 @@
#!/usr/bin/env python
+import Utils
import os
+import sys
# work out what python external libraries we need to install
-external_libs = {
+external_pkgs = {
"dns.resolver": "dnspython/dns",
"iso8601": "pyiso8601/iso8601",
}
+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:
+ if (os.path.isdir(os.path.join(conf.srcdir, ".git")) and
+ os.path.isfile(os.path.join(conf.srcdir, ".gitmodule"))):
+ raise Utils.WafError("""\
+Unable to find Python module '%s'. Please install the system package or check \
+out the relevant submodule by running 'git submodule init; git submodule update'.
+""" % 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
+
+
def configure(conf):
+ for module, package in external_pkgs.items():
+ find_third_party_module(conf, module, package)
conf.RECURSE('popt')
conf.RECURSE('zlib')
@@ -17,7 +54,7 @@ def configure(conf):
def build(bld):
list = []
- for module, package in external_libs.items():
+ for module, package in external_pkgs.items():
try:
__import__(module)
except ImportError: