Commits

pv committed d8f67dc

autosummary: make information messages prettier

Comments (0)

Files changed (2)

sphinx/ext/autosummary/__init__.py

     from sphinx.ext.autosummary.generate import generate_autosummary_docs
 
     ext = app.config.source_suffix
-    genfiles = [path.join(app.srcdir, genfile +
-                          (not genfile.endswith(ext) and ext or ''))
+    genfiles = [genfile + (not genfile.endswith(ext) and ext or '')
                 for genfile in genfiles]
     generate_autosummary_docs(genfiles, warn=app.warn, info=app.info,
-                              suffix=ext)
+                              suffix=ext, base_path=app.srcdir)
 
 
 def setup(app):

sphinx/ext/autosummary/generate.py

     print msg
 
 def _simple_warn(msg):
-    print >>sys.stderr, 'WARNING: ' + msg
+    print >> sys.stderr, 'WARNING: ' + msg
 
 # -- Generating output ---------------------------------------------------------
 
 env = Environment(loader=PackageLoader('sphinx.ext.autosummary', 'templates'))
 
 def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
-                              warn=_simple_warn, info=_simple_info):
-    info('generating autosummary for: %s' % ', '.join(sources))
+                              warn=_simple_warn, info=_simple_info,
+                              base_path=None):
+
+    info('[autosummary] generating autosummary for: %s' %
+         ', '.join(sorted(sources)))
+
     if output_dir:
-        info('writing to %s' % output_dir)
+        info('[autosummary] writing to %s' % output_dir)
+
+    if base_path is not None:
+        sources = [os.path.join(base_path, filename) for filename in sources]
 
     # read
     names = {}
         try:
             obj, name = import_by_name(name)
         except ImportError, e:
-            warn('failed to import %r: %s' % (name, e))
+            warn('[autosummary] failed to import %r: %s' % (name, e))
             continue
 
         fn = os.path.join(path, name + suffix)