Warn on failure to import an extension
authormpm@selenic.com
Fri, 23 Sep 2005 19:04:19 -0700
changeset 1342 5a42da1db402
parent 1341 3ab6e55ee361
child 1343 0f4e53e8c66b
Warn on failure to import an extension
mercurial/commands.py
--- a/mercurial/commands.py	Fri Sep 23 18:59:16 2005 -0700
+++ b/mercurial/commands.py	Fri Sep 23 19:04:19 2005 -0700
@@ -2046,7 +2046,11 @@
     external = []
     for x in u.extensions():
         if x[1]:
-            mod = imp.load_source(x[0], x[1])
+            try:
+                mod = imp.load_source(x[0], x[1])
+            except:
+                u.warn("*** failed to import extension %s\n" % x[1])
+                continue
         else:
             def importh(name):
                 mod = __import__(name)
@@ -2054,7 +2058,12 @@
                 for comp in components[1:]:
                     mod = getattr(mod, comp)
                 return mod
-            mod = importh(x[0])
+            try:
+                mod = importh(x[0])
+            except:
+                u.warn("failed to import extension %s\n" % x[0])
+                continue
+
         external.append(mod)
     for x in external:
         cmdtable = getattr(x, 'cmdtable', {})