samba_external: Simplify script to find missing external packages; include subunit...
authorJelmer Vernooij <jelmer@samba.org>
Wed, 31 Mar 2010 01:15:24 +0000 (03:15 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 31 Mar 2010 01:15:24 +0000 (03:15 +0200)
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
 
 
 # work out what python external libraries we need to install
 
+external_libs = {
+    "dns.resolver": "dnspython", 
+    "subunit": "subunit",
+    "testtools": "testtools"}
+
 list = []
 
 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)
 
 print ' '.join(list)