mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with stable
This commit is contained in:
commit
1b71e6e2c8
3
CHANGES
3
CHANGES
@ -26,6 +26,7 @@ Features added
|
||||
* Add support for docutils 0.12
|
||||
* Added ``sphinx.ext.napoleon`` extension for NumPy and Google style docstring
|
||||
support.
|
||||
* Exception logs now contain the last 10 messages emitted by Sphinx.
|
||||
* Added support for extension versions (a string returned by ``setup()``, these
|
||||
can be shown in the traceback log files). Version requirements for extensions
|
||||
can be specified in projects using the new :confval:`needs_extensions` config
|
||||
@ -69,6 +70,8 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #1563: :meth:`~sphinx.application.Sphinx.add_search_language` raises
|
||||
AssertionError for correct type of argument. Thanks to rikoman.
|
||||
* #1174: Fix smart quotes being applied inside roles like :rst:role:`program` or
|
||||
:rst:role:`makevar`.
|
||||
* #1335: Fix autosummary template overloading with exclamation prefix like
|
||||
|
@ -18,19 +18,20 @@ import types
|
||||
import posixpath
|
||||
import traceback
|
||||
from os import path
|
||||
from collections import deque
|
||||
|
||||
from six import iteritems, itervalues
|
||||
from six.moves import cStringIO
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import convert_directive_function, \
|
||||
directives, roles
|
||||
directives, roles
|
||||
|
||||
import sphinx
|
||||
from sphinx import package_dir, locale
|
||||
from sphinx.roles import XRefRole
|
||||
from sphinx.config import Config
|
||||
from sphinx.errors import SphinxError, SphinxWarning, ExtensionError, \
|
||||
VersionRequirementError, ConfigError
|
||||
VersionRequirementError, ConfigError
|
||||
from sphinx.domains import ObjType, BUILTIN_DOMAINS
|
||||
from sphinx.domains.std import GenericObject, Target, StandardDomain
|
||||
from sphinx.builders import BUILTIN_BUILDERS
|
||||
@ -102,6 +103,9 @@ class Sphinx(object):
|
||||
self._events = events.copy()
|
||||
self._translators = {}
|
||||
|
||||
# keep last few messages for traceback
|
||||
self.messagelog = deque(maxlen=10)
|
||||
|
||||
# say hello to the world
|
||||
self.info(bold('Running Sphinx v%s' % sphinx.__version__))
|
||||
|
||||
@ -264,6 +268,7 @@ class Sphinx(object):
|
||||
wfile.write('\n')
|
||||
if hasattr(wfile, 'flush'):
|
||||
wfile.flush()
|
||||
self.messagelog.append(message)
|
||||
|
||||
def warn(self, message, location=None, prefix='WARNING: '):
|
||||
"""Emit a warning.
|
||||
@ -650,7 +655,7 @@ class Sphinx(object):
|
||||
def add_search_language(self, cls):
|
||||
self.debug('[app] adding search language: %r', cls)
|
||||
from sphinx.search import languages, SearchLanguage
|
||||
assert isinstance(cls, SearchLanguage)
|
||||
assert issubclass(cls, SearchLanguage)
|
||||
languages[cls.lang] = cls
|
||||
|
||||
|
||||
|
@ -321,8 +321,8 @@ class Builder(object):
|
||||
|
||||
# finish (write static files etc.)
|
||||
self.finish()
|
||||
status = (self.app.statuscode == 0 and 'succeeded'
|
||||
or 'finished with problems')
|
||||
status = (self.app.statuscode == 0
|
||||
and 'succeeded' or 'finished with problems')
|
||||
if self.app._warncount:
|
||||
self.info(bold('build %s, %s warning%s.' %
|
||||
(status, self.app._warncount,
|
||||
@ -431,7 +431,7 @@ class Builder(object):
|
||||
threads.append(t)
|
||||
|
||||
# make sure all threads have finished
|
||||
self.info(bold('waiting for workers... '))#, nonl=True)
|
||||
self.info(bold('waiting for workers... '))
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
||||
|
@ -30,6 +30,7 @@ import jinja2
|
||||
|
||||
import sphinx
|
||||
from sphinx.errors import PycodeError
|
||||
from sphinx.util.console import strip_colors
|
||||
|
||||
# import other utilities; partly for backwards compatibility, so don't
|
||||
# prune unused ones indiscriminately
|
||||
@ -176,6 +177,8 @@ _DEBUG_HEADER = '''\
|
||||
# Python version: %s
|
||||
# Docutils version: %s %s
|
||||
# Jinja2 version: %s
|
||||
# Last messages:
|
||||
%s
|
||||
# Loaded extensions:
|
||||
'''
|
||||
|
||||
@ -184,11 +187,17 @@ def save_traceback(app):
|
||||
import platform
|
||||
exc = traceback.format_exc()
|
||||
fd, path = tempfile.mkstemp('.log', 'sphinx-err-')
|
||||
last_msgs = ''
|
||||
if app is not None:
|
||||
last_msgs = '\n'.join(
|
||||
'# %s' % strip_colors(force_decode(s, 'utf-8')).strip()
|
||||
for s in app.messagelog)
|
||||
os.write(fd, (_DEBUG_HEADER %
|
||||
(sphinx.__version__,
|
||||
platform.python_version(),
|
||||
docutils.__version__, docutils.__version_details__,
|
||||
jinja2.__version__)).encode('utf-8'))
|
||||
jinja2.__version__,
|
||||
last_msgs)).encode('utf-8'))
|
||||
if app is not None:
|
||||
for extname, extmod in iteritems(app._extensions):
|
||||
os.write(fd, ('# %s (%s) from %s\n' % (
|
||||
|
@ -74,6 +74,9 @@ def coloron():
|
||||
def colorize(name, text):
|
||||
return codes.get(name, '') + text + codes.get('reset', '')
|
||||
|
||||
def strip_colors(s):
|
||||
return re.compile('\x1b.*?m').sub('', s)
|
||||
|
||||
def create_color_func(name):
|
||||
def inner(text):
|
||||
return colorize(name, text)
|
||||
|
Loading…
Reference in New Issue
Block a user