samba_external: Simplify script to find missing external packages; include subunit...
[idra/samba.git] / source4 / scripting / python / samba_external / missing.py
index 50bda65a210296dc81811894332c51e0e980c637..082afd839715cdca97e2ce1d9adc68ea76a8546b 100755 (executable)
@@ -2,11 +2,17 @@
 
 # work out what python external libraries we need to install
 
+external_libs = {
+    "dns.resolver": "dnspython", 
+    "subunit": "subunit",
+    "testtools": "testtools"}
+
 list = []
 
-try:
-    import dns.resolver
-except:
-    list.append("dnspython")
+for module, package in external_libs.iteritems():
+    try:
+        __import__(module)
+    except ImportError:
+        list.append(package)
 
 print ' '.join(list)