Commits

Georg Brandl committed f8bd2af

Add list of extensions to the traceback log file on unhandled exceptions.

Comments (0)

Files changed (2)

sphinx/cmdline.py

             print >>status, 'Making output directory...'
         os.makedirs(outdir)
 
+    app = None
     try:
         app = Sphinx(srcdir, confdir, outdir, doctreedir, buildername,
                      confoverrides, status, warning, freshenv,
             else:
                 print >>error, red('Exception occurred:')
                 print >>error, format_exception_cut_frames().rstrip()
-                tbpath = save_traceback()
+                tbpath = save_traceback(app)
                 print >>error, red('The full traceback has been saved '
                                    'in %s, if you want to report the '
                                    'issue to the developers.' % tbpath)

sphinx/util/__init__.py

 # Python version: %s
 # Docutils version: %s %s
 # Jinja2 version: %s
+# Loaded extensions: %s
 '''
 
-def save_traceback():
+def save_traceback(app):
     """Save the current exception's traceback in a temporary file."""
     import platform
     exc = traceback.format_exc()
     fd, path = tempfile.mkstemp('.log', 'sphinx-err-')
+    if app is not None:
+        extension_list = ', '.join(app._extensions)
+    else:
+        extension_list = '(app not created)'
     os.write(fd, (_DEBUG_HEADER %
                   (sphinx.__version__,
                    platform.python_version(),
                    docutils.__version__, docutils.__version_details__,
-                   jinja2.__version__)).encode('utf-8'))
+                   jinja2.__version__,
+                   extension_list)).encode('utf-8'))
     os.write(fd, exc.encode('utf-8'))
     os.close(fd)
     return path