Commits

shoma h4a  committed 9ee82a4

fixed an issue where sphinx-build command terminated when theme module import error occurred.

  • Participants
  • Parent commits 040c63f

Comments (0)

Files changed (1)

File src/sphinxjp/themecore/__init__.py

 # -*- coding: utf-8 -*-
 
+import sys
 import pkg_resources
 
 
     theme_paths = []
 
     for plugin in pkg_resources.iter_entry_points('sphinx_themes'):
-        m = plugin.load()
+        try:
+            m = plugin.load()
+        except ImportError:
+            msg = "warn: Can't import '" + plugin.module_name + "'\n"
+            sys.stderr.write(msg)
+            continue
+        
         if callable(m):
             path = m()
         else:
 
 def setup_directives(app):
     for plugin in pkg_resources.iter_entry_points('sphinx_directives'):
-        module_setup = plugin.load()
+        try:
+            module_setup = plugin.load()
+        except ImportError:
+            msg = "warn: Can't import '" + plugin.module_name + "'\n"
+            sys.stderr.write(msg)
+            continue
+        
         module_setup(app)