Merge branch 'stable' into 3256_update_release_script

This commit is contained in:
Takeshi KOMIYA 2017-01-06 23:44:10 +09:00 committed by GitHub
commit ed6742fe2a
15 changed files with 90 additions and 54 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
*.swp
.dir-locals.el
.mypy_cache/
.ropeproject/
TAGS
.tags

View File

@ -7,6 +7,7 @@ python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "nightly"
- "pypy"
env:
@ -17,6 +18,16 @@ env:
matrix:
- DOCUTILS=0.12
- DOCUTILS=0.13.1
matrix:
exclude:
- python: "3.4"
env: DOCUTILS=0.12
- python: "3.5"
env: DOCUTILS=0.12
- python: nightly
env: DOCUTILS=0.12
- python: pypy
env: DOCUTILS=0.12
addons:
apt:
packages:
@ -31,8 +42,7 @@ install:
- pip install -U pip setuptools
- pip install docutils==$DOCUTILS
- pip install -r test-reqs.txt
before_script:
- if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8; fi
script:
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then make style-check test-async; fi
- if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then make test; fi
- flake8
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check test-async; fi
- if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi

View File

@ -6,6 +6,7 @@ Features added
* #3241: emit latex warning if buggy titlesec (ref #3210)
* #3194: Refer the $MAKE environment variable to determine ``make`` command
* Emit warning for nested numbered toctrees (refs: #3142)
Bugs fixed
----------
@ -17,6 +18,10 @@ Bugs fixed
* #3255: In Py3.4 environment, autodoc doesn't support documentation for
attributes of Enum class correctly.
* #3261: ``latex_use_parts`` makes sphinx crash
* The warning type ``misc.highlighting_failure`` does not work
* #3294: ``add_latex_package()`` make crashes non-LaTeX builders
* The caption of table are rendered as invalid HTML (refs: #3287)
Release 1.5.1 (released Dec 13, 2016)
=====================================

View File

@ -233,6 +233,7 @@ General configuration
* ref.citation
* ref.doc
* misc.highlighting_failure
* toc.secnum
* epub.unknown_project_files
You can choose from these types.

View File

@ -79,8 +79,8 @@ sidebar and under "Quick Links", click "Windows Installer" to download.
.. note::
Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.3 can run
under Python 2.7, 3.4, 3.5, with the recommended version being 2.7. This
Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.5 can run
under Python 2.7, 3.4, 3.5, 3.6, with the recommended version being 2.7. This
chapter assumes you have installed Python 2.7.
Follow the Windows installer for Python.

View File

@ -26,4 +26,4 @@ universal = 1
[flake8]
max-line-length = 95
ignore = E113,E116,E221,E226,E241,E251,E901
exclude = tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
exclude = .git,.tox,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py

View File

@ -806,7 +806,8 @@ class Sphinx(object):
def add_latex_package(self, packagename, options=None):
self.debug('[app] adding latex package: %r', packagename)
self.builder.usepackages.append((packagename, options))
if hasattr(self.builder, 'usepackages'): # only for LaTeX builder
self.builder.usepackages.append((packagename, options))
def add_lexer(self, alias, lexer):
self.debug('[app] adding lexer: %r', (alias, lexer))

View File

@ -268,13 +268,28 @@ def validate_config_values(app):
app.config.latex_elements['postamble'] = app.config.latex_elements['footer']
def default_latex_engine(config):
""" Better default latex_engine settings for specific languages. """
if config.language == 'ja':
return 'platex'
else:
return 'pdflatex'
def default_latex_docclass(config):
""" Better default latex_docclass settings for specific languages. """
if config.language == 'ja':
return {'manual': 'jsbook',
'howto': 'jreport'}
else:
return {}
def setup(app):
app.add_builder(LaTeXBuilder)
app.connect('builder-inited', validate_config_values)
app.add_config_value('latex_engine',
lambda self: 'pdflatex' if self.language != 'ja' else 'platex',
None,
app.add_config_value('latex_engine', default_latex_engine, None,
ENUM('pdflatex', 'xelatex', 'lualatex', 'platex'))
app.add_config_value('latex_documents',
lambda self: [(self.master_doc, make_filename(self.project) + '.tex',
@ -297,11 +312,7 @@ def setup(app):
app.add_config_value('latex_elements', {}, None)
app.add_config_value('latex_additional_files', [], None)
japanese_default = {'manual': 'jsbook',
'howto': 'jreport'}
app.add_config_value('latex_docclass',
lambda self: japanese_default if self.language == 'ja' else {},
None)
app.add_config_value('latex_docclass', default_latex_docclass, None)
# now deprecated - use latex_elements
app.add_config_value('latex_preamble', '', None)

View File

@ -464,10 +464,14 @@ class Toctree(EnvironmentManager):
if depth == 0:
return
for (title, ref) in toctreenode['entries']:
if url_re.match(ref) or ref == 'self' or ref in assigned:
if url_re.match(ref) or ref == 'self':
# don't mess with those
continue
if ref in self.tocs:
elif ref in assigned:
self.env.warn_node('%s is already assigned section numbers '
'(nested numbered toctree?)' % ref,
toctreenode, type='toc', subtype='secnum')
elif ref in self.tocs:
secnums = self.toc_secnumbers[ref] = {}
assigned.add(ref)
_walk_toc(self.tocs[ref], secnums, depth,

View File

@ -144,7 +144,7 @@ class PygmentsBridge(object):
elif warn:
warn('Could not lex literal_block as "%s". '
'Highlighting skipped.' % lang,
type='misc', subtype='higlighting_failure')
type='misc', subtype='highlighting_failure')
else:
raise exc
hlsource = highlight(source, lexers['none'], formatter)

View File

@ -414,7 +414,7 @@ class IndexBuilder(object):
def get_js_stemmer_rawcode(self):
if self.lang.js_stemmer_rawcode:
return path.join(
path.dirname(path.abspath(__file__)),
sphinx.package_dir, 'search',
'non-minified-js',
self.lang.js_stemmer_rawcode
)

View File

@ -211,9 +211,10 @@ def save_traceback(app):
modfile = getattr(extmod, '__file__', 'unknown')
if isinstance(modfile, bytes):
modfile = modfile.decode(fs_encoding, 'replace')
os.write(fd, ('# %s (%s) from %s\n' % (
extname, app._extension_metadata[extname]['version'],
modfile)).encode('utf-8'))
version = app._extension_metadata[extname]['version']
if version != 'builtin':
os.write(fd, ('# %s (%s) from %s\n' %
(extname, version, modfile)).encode('utf-8'))
os.write(fd, exc_format.encode('utf-8'))
os.close(fd)
return path

View File

@ -343,6 +343,27 @@ class HTMLTranslator(BaseTranslator):
if isinstance(node.parent, nodes.table):
self.body.append('<span class="caption-text">')
def depart_title(self, node):
close_tag = self.context[-1]
if (self.permalink_text and self.builder.add_permalinks and
node.parent.hasattr('ids') and node.parent['ids']):
# add permalink anchor
if close_tag.startswith('</h'):
self.add_permalink_ref(node.parent, _('Permalink to this headline'))
elif close_tag.startswith('</a></h'):
self.body.append(u'</a><a class="headerlink" href="#%s" ' %
node.parent['ids'][0] +
u'title="%s">%s' % (
_('Permalink to this headline'),
self.permalink_text))
elif isinstance(node.parent, nodes.table):
self.body.append('</span>')
self.add_permalink_ref(node.parent, _('Permalink to this table'))
elif isinstance(node.parent, nodes.table):
self.body.append('</span>')
BaseTranslator.depart_title(self, node)
# overwritten
def visit_literal_block(self, node):
if node.rawsource != node.astext():
@ -709,25 +730,6 @@ class HTMLTranslator(BaseTranslator):
def depart_manpage(self, node):
return self.depart_literal_emphasis(node)
def depart_title(self, node):
close_tag = self.context[-1]
if (self.permalink_text and self.builder.add_permalinks and
node.parent.hasattr('ids') and node.parent['ids']):
# add permalink anchor
if close_tag.startswith('</h'):
self.add_permalink_ref(node.parent, _('Permalink to this headline'))
elif close_tag.startswith('</a></h'):
self.body.append(u'</a><a class="headerlink" href="#%s" ' %
node.parent['ids'][0] +
u'title="%s">%s' % (
_('Permalink to this headline'),
self.permalink_text))
elif isinstance(node.parent, nodes.table):
self.body.append('</span>')
self.add_permalink_ref(node.parent, _('Permalink to this table'))
BaseTranslator.depart_title(self, node)
# overwritten to add even/odd classes
def visit_table(self, node):

View File

@ -50,7 +50,7 @@ def kpsetest(*filenames):
except OSError:
# no kpsewhich... either no tex distribution is installed or it is
# a "strange" one -- don't bother running latex
return None
return False
else:
p.communicate()
if p.returncode != 0:
@ -84,8 +84,8 @@ def compile_latex_document(app):
def skip_if_stylefiles_notfound(testfunc):
if kpsetest(*STYLEFILES) is False:
return skip_if(testfunc,
'not running latex, the required styles do not seem to be installed')
msg = 'not running latex, the required styles do not seem to be installed'
return skip_if(True, msg)(testfunc)
else:
return testfunc

18
tox.ini
View File

@ -1,20 +1,21 @@
[tox]
envlist=flake8,py27,py34,py35,pypy,du12,du11,du10
envlist=flake8,py27,py34,py35,py36,pypy,du13,du12,du11
[testenv]
deps=
six
nose
docutils
sqlalchemy
whoosh
html5lib
mock
enum34
typing
setenv =
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
PYTHONDONTWRITEBYTECODE = true
commands=
{envpython} -Wall tests/run.py -I py35 -m '^[tT]est' {posargs}
{envpython} -Wall tests/run.py --ignore-files=test_autodoc_py35 -m '^[tT]est' {posargs}
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
[testenv:pypy]
@ -22,11 +23,6 @@ deps=
simplejson
{[testenv]deps}
[testenv:du10]
deps=
docutils==0.10
{[testenv]deps}
[testenv:du11]
deps=
docutils==0.11
@ -37,13 +33,17 @@ deps=
docutils==0.12
{[testenv]deps}
[testenv:du13]
deps=
docutils==0.13.1
{[testenv]deps}
[testenv:flake8]
deps=flake8
commands=flake8
[testenv:py27]
deps=
enum34
{[testenv]deps}
[testenv:py35]