summaryrefslogtreecommitdiff
path: root/python/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'python/wscript')
-rw-r--r--python/wscript25
1 files changed, 25 insertions, 0 deletions
diff --git a/python/wscript b/python/wscript
index 916031896d3..b0481560ea5 100644
--- a/python/wscript
+++ b/python/wscript
@@ -2,6 +2,26 @@
import os
+# work out what python external libraries we need to be successful
+selftest_pkgs = {
+ 'iso8601': 'python3-iso8601',
+}
+
+
+def find_third_party_module(conf, module, package):
+ conf.COMPOUND_START("Checking for system installation of Python module %s" % module)
+ try:
+ __import__(module)
+ except ImportError:
+ conf.COMPOUND_END(False)
+ raise Errors.WafError("""\
+ Unable to find Python module '%s'. Please install the system package: %s'.
+""" % (module, package))
+ else:
+ # Installed on the system
+ conf.COMPOUND_END("system")
+
+
def configure(conf):
if conf.env.disable_python:
return
@@ -41,6 +61,11 @@ def configure(conf):
finally:
f.close()
+ if conf.CONFIG_GET('ENABLE_SELFTEST'):
+ for module, package in selftest_pkgs.items():
+ find_third_party_module(conf, module, package)
+
+
def build(bld):