mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.6-release' into 3633_misdetect_unreferenced_citations
This commit is contained in:
commit
8f0d269069
64
CHANGES
64
CHANGES
@ -1,34 +1,63 @@
|
||||
Release 1.6 beta2 (in development)
|
||||
Release 1.6 beta3 (in development)
|
||||
==================================
|
||||
|
||||
Incompatible changes
|
||||
--------------------
|
||||
|
||||
* #3345: Replace the custom smartypants code with docutils' smart_quotes
|
||||
* LaTeX package ``eqparbox`` is not used and not loaded by Sphinx anymore
|
||||
* LaTeX package ``multirow`` is not used and not loaded by Sphinx anymore
|
||||
* Add line numbers to citation data in std domain
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
||||
* ``LATEXMKOPTS`` variable for the Makefile in ``$BUILDDIR/latex`` to pass
|
||||
options to ``latexmk`` when executing ``make latexpdf``. Default is ``-f``.
|
||||
(refs #3695)
|
||||
* Add a new event `env-check-consistency` to check consistency to extensions
|
||||
* Add `Domain.check_consistency()` to check consistency
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #3588: No compact (p tag) html output in the i18n document build even when
|
||||
:confval:`html_compact_lists` is True.
|
||||
* The ``make latexpdf`` from 1.6b1 (for GNU/Linux and Mac OS, using
|
||||
``latexmk``) aborted earlier in case of LaTeX errors than was the case with
|
||||
1.5 series, due to hard-coded usage of ``--halt-on-error`` option. (refs #3695)
|
||||
* #3683: sphinx.websupport module is not provided by default
|
||||
* #3683: Failed to build document if builder.css_file.insert() is called
|
||||
* #3714: viewcode extension not taking ``highlight_code='none'`` in account
|
||||
* #3698: Moving :doc: to std domain broke backwards compatibility
|
||||
* #3633: misdetect unreferenced citations
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
Release 1.6 beta2 (released Apr 29, 2017)
|
||||
=========================================
|
||||
|
||||
Incompatible changes
|
||||
--------------------
|
||||
|
||||
* #3345: Replace the custom smartypants code with Docutils' smart_quotes.
|
||||
Thanks to Dmitry Shachnev, and to Günter Milde at Docutils.
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
||||
* #3662: ``builder.css_files`` is deprecated. Please use ``add_stylesheet()``
|
||||
API instead.
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
||||
* Add a new event `env-check-consistency` to check consistency to extensions
|
||||
* Add `Domain.check_consistency()` to check consistency
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #3661: sphinx-build crashes on parallel build
|
||||
* #3669: gettext builder fails with "ValueError: substring not found"
|
||||
* #3660: Sphinx always depends on sphinxcontrib-websupport and its dependencies
|
||||
* #3633: misdetect unreferenced citations
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
Release 1.6 beta1 (released Apr 24, 2017)
|
||||
=========================================
|
||||
@ -226,6 +255,10 @@ Bugs fixed
|
||||
* #3618: autodoc crashes with tupled arguments
|
||||
* #3664: No space after the bullet in items of a latex list produced by Sphinx
|
||||
* #3657: EPUB builder crashes if document startswith genindex exists
|
||||
* #3588: No compact (p tag) html output in the i18n document build even when
|
||||
:confval:`html_compact_lists` is True.
|
||||
* #3685: AttributeError when using 3rd party domains
|
||||
* #3702: LaTeX writer styles figure legends with a hard-coded ``\small``
|
||||
|
||||
Testing
|
||||
--------
|
||||
@ -426,10 +459,8 @@ Incompatible changes
|
||||
* QtHelpBuilder doens't generate search page (ref: #2352)
|
||||
* QtHelpBuilder uses ``nonav`` theme instead of default one
|
||||
to improve readability.
|
||||
* latex: To provide good default settings to Japanese docs, Sphinx uses ``jsbook``
|
||||
as a docclass by default if the ``language`` is ``ja``.
|
||||
* latex: To provide good default settings to Japanese docs, Sphinx uses
|
||||
``jreport`` and ``jsbooks`` as a docclass by default if the ``language`` is
|
||||
* latex: To provide good default settings to Japanese documents, Sphinx uses
|
||||
``jreport`` and ``jsbook`` as docclass if :confval:`language` is
|
||||
``ja``.
|
||||
* ``sphinx-quickstart`` now allows a project version is empty
|
||||
* Fix :download: role on epub/qthelp builder. They ignore the role because they don't support it.
|
||||
@ -469,6 +500,7 @@ Incompatible changes
|
||||
* Emit warnings that will be deprecated in Sphinx 1.6 by default.
|
||||
Users can change the behavior by setting the environment variable
|
||||
PYTHONWARNINGS. Please refer :ref:`when-deprecation-warnings-are-displayed`.
|
||||
* #2454: new JavaScript variable ``SOURCELINK_SUFFIX`` is added
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
@ -202,6 +202,31 @@ The builder's "name" must be given to the **-b** command-line option of
|
||||
.. versionchanged:: 1.6
|
||||
Use of ``latexmk`` on GNU/Linux or Mac OS X.
|
||||
|
||||
Since 1.6, ``make latexpdf`` (or ``make -C "<builddir>/latex"`` after a
|
||||
``sphinx-build`` run) uses ``latexmk`` (on GNU/Linux and Mac OS X).
|
||||
It invokes it with option ``-f`` which attempts to complete targets
|
||||
even in case of LaTeX processing errors. This can be overridden via
|
||||
``LATEXMKOPTS`` variable, for example:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
make latexpdf LATEXMKOPTS=""
|
||||
|
||||
The ``pdflatex`` calls themselves obey the ``LATEXOPTS`` variable whose
|
||||
default is ``--interaction=nonstopmode`` (same as ``-interaction
|
||||
nonstopmode``.) In order to stop the
|
||||
compilation on first error one can use ``--halt-on-error``.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
make latexpdf LATEXMKOPTS="-silent" LATEXOPTS="--halt-on-error"
|
||||
|
||||
In case the first ``pdflatex`` run aborts with an error, this will stop
|
||||
further ``latexmk`` processing (no ``-f`` option). The console output
|
||||
will be kept to a bare minimum during target processing (``-silent``).
|
||||
|
||||
.. autoattribute:: name
|
||||
|
||||
.. autoattribute:: format
|
||||
|
@ -438,7 +438,14 @@ Let us now list some macros from the package file
|
||||
the new macros are wrappers of the formerly hard-coded ``\texttt``,
|
||||
``\emph``, ... The default definitions can be found in
|
||||
:file:`sphinx.sty`.
|
||||
- paragraph level environments: for each admonition type ``<foo>``, the
|
||||
- a :dudir:`figure` may have an optional legend with arbitrary body
|
||||
elements: they are rendered in a ``sphinxlegend`` environment. The default
|
||||
definition issues ``\small``, and ends with ``\par``.
|
||||
|
||||
.. versionadded:: 1.5.6
|
||||
formerly, the ``\small`` was hardcoded in LaTeX writer and the ending
|
||||
``\par`` was lacking.
|
||||
- for each admonition type ``<foo>``, the
|
||||
used environment is named ``sphinx<foo>``. They may be ``\renewenvironment``
|
||||
'd individually, and must then be defined with one argument (it is the heading
|
||||
of the notice, for example ``Warning:`` for :dudir:`warning` directive, if
|
||||
|
1
mypy.ini
1
mypy.ini
@ -2,7 +2,6 @@
|
||||
python_version = 2.7
|
||||
ignore_missing_imports = True
|
||||
follow_imports = skip
|
||||
fast_parser = True
|
||||
incremental = True
|
||||
check_untyped_defs = True
|
||||
warn_unused_ignores = True
|
||||
|
4
setup.py
4
setup.py
@ -53,6 +53,7 @@ requires = [
|
||||
'requests>=2.0.0',
|
||||
'typing',
|
||||
'setuptools',
|
||||
'sphinxcontrib-websupport',
|
||||
]
|
||||
extras_require = {
|
||||
# Environment Marker works for wheel 0.24 or later
|
||||
@ -60,7 +61,8 @@ extras_require = {
|
||||
'colorama>=0.3.5',
|
||||
],
|
||||
'websupport': [
|
||||
'sphinxcontrib-websupport',
|
||||
'sqlalchemy>=0.9',
|
||||
'whoosh>=2.0',
|
||||
],
|
||||
'test': [
|
||||
'pytest',
|
||||
|
@ -40,7 +40,7 @@ __released__ = '1.6' # used when Sphinx builds its own docs
|
||||
# version info for better programmatic use
|
||||
# possible values for 3rd element: 'alpha', 'beta', 'rc', 'final'
|
||||
# 'final' has 0 as the last element
|
||||
version_info = (1, 6, 0, 'beta', 2)
|
||||
version_info = (1, 6, 0, 'beta', 3)
|
||||
|
||||
package_dir = path.abspath(path.dirname(__file__))
|
||||
|
||||
@ -58,7 +58,7 @@ if __version__.endswith('+'):
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
if out:
|
||||
__display_version__ += '/' + out.decode().strip() # type: ignore
|
||||
__display_version__ += '/' + out.decode().strip()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
@ -190,7 +190,7 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
# Build the access page
|
||||
logger.info(bold('building access page...'), nonl=True)
|
||||
with codecs.open(path.join(language_dir, '_access.html'), 'w') as f:
|
||||
with codecs.open(path.join(language_dir, '_access.html'), 'w') as f: # type: ignore
|
||||
f.write(access_page_template % {
|
||||
'toc': htmlescape(toc, quote=True),
|
||||
'title': htmlescape(self.config.applehelp_title)
|
||||
|
@ -31,7 +31,7 @@ from sphinx.locale import pairindextypes
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any, Dict, Iterable, List, Set, Tuple # NOQA
|
||||
from typing import Any, DefaultDict, Dict, Iterable, List, Set, Tuple # NOQA
|
||||
from docutils import nodes # NOQA
|
||||
from sphinx.util.i18n import CatalogInfo # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
@ -122,7 +122,7 @@ class I18nBuilder(Builder):
|
||||
self.env.set_versioning_method(self.versioning_method,
|
||||
self.env.config.gettext_uuid)
|
||||
self.tags = I18nTags()
|
||||
self.catalogs = defaultdict(Catalog) # type: defaultdict[unicode, Catalog]
|
||||
self.catalogs = defaultdict(Catalog) # type: DefaultDict[unicode, Catalog]
|
||||
|
||||
def get_target_uri(self, docname, typ=None):
|
||||
# type: (unicode, unicode) -> unicode
|
||||
|
@ -100,6 +100,15 @@ class CSSContainer(list):
|
||||
else:
|
||||
super(CSSContainer, self).append(Stylesheet(obj, None, 'stylesheet'))
|
||||
|
||||
def insert(self, index, obj):
|
||||
warnings.warn('builder.css_files is deprecated. '
|
||||
'Please use app.add_stylesheet() instead.',
|
||||
RemovedInSphinx20Warning)
|
||||
if isinstance(obj, Stylesheet):
|
||||
super(CSSContainer, self).insert(index, obj)
|
||||
else:
|
||||
super(CSSContainer, self).insert(index, Stylesheet(obj, None, 'stylesheet'))
|
||||
|
||||
def extend(self, other):
|
||||
warnings.warn('builder.css_files is deprecated. '
|
||||
'Please use app.add_stylesheet() instead.',
|
||||
@ -381,7 +390,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
# typically doesn't include the time of day
|
||||
lufmt = self.config.html_last_updated_fmt
|
||||
if lufmt is not None:
|
||||
self.last_updated = format_date(lufmt or _('%b %d, %Y'),
|
||||
self.last_updated = format_date(lufmt or _('%b %d, %Y'), # type: ignore
|
||||
language=self.config.language)
|
||||
else:
|
||||
self.last_updated = None
|
||||
@ -814,7 +823,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
else:
|
||||
f = open(searchindexfn, 'rb') # type: ignore
|
||||
with f:
|
||||
self.indexer.load(f, self.indexer_format) # type: ignore
|
||||
self.indexer.load(f, self.indexer_format)
|
||||
except (IOError, OSError, ValueError):
|
||||
if keep:
|
||||
logger.warning('search index couldn\'t be loaded, but not all '
|
||||
@ -984,7 +993,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
else:
|
||||
f = open(searchindexfn + '.tmp', 'wb') # type: ignore
|
||||
with f:
|
||||
self.indexer.dump(f, self.indexer_format) # type: ignore
|
||||
self.indexer.dump(f, self.indexer_format)
|
||||
movefile(searchindexfn + '.tmp', searchindexfn)
|
||||
logger.info('done')
|
||||
|
||||
|
@ -16,7 +16,7 @@ import threading
|
||||
from os import path
|
||||
|
||||
from requests.exceptions import HTTPError
|
||||
from six.moves import queue, html_parser # type: ignore
|
||||
from six.moves import queue, html_parser
|
||||
from six.moves.urllib.parse import unquote
|
||||
from docutils import nodes
|
||||
|
||||
@ -105,8 +105,8 @@ class CheckExternalLinksBuilder(Builder):
|
||||
open(path.join(self.outdir, 'output.txt'), 'w').close()
|
||||
|
||||
# create queues and worker threads
|
||||
self.wqueue = queue.Queue()
|
||||
self.rqueue = queue.Queue()
|
||||
self.wqueue = queue.Queue() # type: queue.Queue
|
||||
self.rqueue = queue.Queue() # type: queue.Queue
|
||||
self.workers = [] # type: List[threading.Thread]
|
||||
for i in range(self.app.config.linkcheck_workers):
|
||||
thread = threading.Thread(target=self.check_thread)
|
||||
|
@ -206,7 +206,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
# write the project file
|
||||
with codecs.open(path.join(outdir, outname + '.qhp'), 'w', 'utf-8') as f: # type: ignore # NOQA
|
||||
f.write(project_template % { # type: ignore
|
||||
f.write(project_template % {
|
||||
'outname': htmlescape(outname),
|
||||
'title': htmlescape(self.config.html_title),
|
||||
'version': htmlescape(self.config.version),
|
||||
@ -223,7 +223,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
logger.info('writing collection project file...')
|
||||
with codecs.open(path.join(outdir, outname + '.qhcp'), 'w', 'utf-8') as f: # type: ignore # NOQA
|
||||
f.write(collection_template % { # type: ignore
|
||||
f.write(collection_template % {
|
||||
'outname': htmlescape(outname),
|
||||
'title': htmlescape(self.config.html_short_title),
|
||||
'homepage': htmlescape(homepage),
|
||||
|
@ -9,8 +9,6 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from sphinxcontrib.websupport.builder import WebSupportBuilder
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any, Dict # NOQA
|
||||
@ -19,7 +17,11 @@ if False:
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_builder(WebSupportBuilder)
|
||||
try:
|
||||
from sphinxcontrib.websupport.builder import WebSupportBuilder
|
||||
app.add_builder(WebSupportBuilder)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
return {
|
||||
'version': 'builtin',
|
||||
|
@ -48,7 +48,7 @@ try:
|
||||
if sys.version_info >= (3,):
|
||||
import typing
|
||||
else:
|
||||
typing = None # type: ignore
|
||||
typing = None
|
||||
except ImportError:
|
||||
typing = None
|
||||
|
||||
|
@ -259,8 +259,7 @@ def find_autosummary_in_files(filenames):
|
||||
with codecs.open(filename, 'r', encoding='utf-8', # type: ignore
|
||||
errors='ignore') as f:
|
||||
lines = f.read().splitlines()
|
||||
documented.extend(find_autosummary_in_lines(lines, # type: ignore
|
||||
filename=filename))
|
||||
documented.extend(find_autosummary_in_lines(lines, filename=filename))
|
||||
return documented
|
||||
|
||||
|
||||
@ -273,7 +272,7 @@ def find_autosummary_in_docstring(name, module=None, filename=None):
|
||||
try:
|
||||
real_name, obj, parent, modname = import_by_name(name)
|
||||
lines = pydoc.getdoc(obj).splitlines()
|
||||
return find_autosummary_in_lines(lines, module=name, filename=filename)
|
||||
return find_autosummary_in_lines(lines, module=name, filename=filename) # type: ignore
|
||||
except AttributeError:
|
||||
pass
|
||||
except ImportError as e:
|
||||
|
@ -307,7 +307,7 @@ class DocTestBuilder(Builder):
|
||||
self.outfile = None # type: IO
|
||||
self.outfile = codecs.open(path.join(self.outdir, 'output.txt'), # type: ignore
|
||||
'w', encoding='utf-8')
|
||||
self.outfile.write(('Results of doctest builder run on %s\n' # type: ignore
|
||||
self.outfile.write(('Results of doctest builder run on %s\n'
|
||||
'==================================%s\n') %
|
||||
(date, '=' * len(date)))
|
||||
|
||||
|
@ -66,7 +66,7 @@ def process_ifconfig_nodes(app, doctree, docname):
|
||||
except Exception as err:
|
||||
# handle exceptions in a clean fashion
|
||||
from traceback import format_exception_only
|
||||
msg = ''.join(format_exception_only(err.__class__, err)) # type: ignore
|
||||
msg = ''.join(format_exception_only(err.__class__, err))
|
||||
newnode = doctree.reporter.error('Exception occured in '
|
||||
'ifconfig expression: \n%s' %
|
||||
msg, base_node=node)
|
||||
|
@ -42,7 +42,7 @@ import inspect
|
||||
try:
|
||||
from hashlib import md5
|
||||
except ImportError:
|
||||
from md5 import md5 # type: ignore
|
||||
from md5 import md5
|
||||
|
||||
from six import text_type
|
||||
from six.moves import builtins
|
||||
|
@ -156,7 +156,7 @@ def collect_pages(app):
|
||||
# construct a page name for the highlighted source
|
||||
pagename = '_modules/' + modname.replace('.', '/')
|
||||
# highlight the source using the builder's highlighter
|
||||
if env.config.highlight_language in ('python3', 'default'):
|
||||
if env.config.highlight_language in ('python3', 'default', 'none'):
|
||||
lexer = env.config.highlight_language
|
||||
else:
|
||||
lexer = 'python'
|
||||
|
@ -557,7 +557,7 @@ def valid_dir(d):
|
||||
|
||||
|
||||
class MyFormatter(optparse.IndentedHelpFormatter):
|
||||
def format_usage(self, usage):
|
||||
def format_usage(self, usage): # type: ignore
|
||||
# type: (str) -> str
|
||||
return usage
|
||||
|
||||
|
@ -133,7 +133,7 @@ class SphinxComponentRegistry(object):
|
||||
directive = type(directivename, # type: ignore
|
||||
(GenericObject, object),
|
||||
{'indextemplate': indextemplate,
|
||||
'parse_node': staticmethod(parse_node), # type: ignore
|
||||
'parse_node': staticmethod(parse_node),
|
||||
'doc_field_types': doc_field_types})
|
||||
|
||||
stddomain = self.domains['std']
|
||||
|
@ -41,7 +41,7 @@ from sphinx.util import import_object
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Dict, List # NOQA
|
||||
from typing import Any, Dict, List # NOQA
|
||||
|
||||
|
||||
class BaseSplitter(object):
|
||||
@ -65,8 +65,8 @@ class MecabSplitter(BaseSplitter):
|
||||
def __init__(self, options):
|
||||
# type: (Dict) -> None
|
||||
super(MecabSplitter, self).__init__(options)
|
||||
self.ctypes_libmecab = None # type: ignore
|
||||
self.ctypes_mecab = None # type: ignore
|
||||
self.ctypes_libmecab = None # type: Any
|
||||
self.ctypes_mecab = None # type: Any
|
||||
if not native_module:
|
||||
self.init_ctypes(options)
|
||||
else:
|
||||
|
@ -25,16 +25,6 @@
|
||||
\usepackage<%= sphinxpkgoptions %>{sphinx}
|
||||
<%= sphinxsetup %>
|
||||
<%= geometry %>
|
||||
\usepackage{multirow}
|
||||
\let\originalmutirow\multirow\protected\def\multirow{%
|
||||
\sphinxdeprecationwarning{\multirow}{1.6}{1.7}
|
||||
{Sphinx does not use package multirow. Its loading will be removed at 1.7.}%
|
||||
\originalmultirow}%
|
||||
\usepackage{eqparbox}
|
||||
\let\originaleqparbox\eqparbox\protected\def\eqparbox{%
|
||||
\sphinxdeprecationwarning{\eqparbox}{1.6}{1.7}
|
||||
{Sphinx does not use package eqparbox. Its loading will be removed at 1.7.}%
|
||||
\originaleqparbox}%
|
||||
<%= usepackages %>
|
||||
<%= hyperref %>
|
||||
<%= contentsname %>
|
||||
|
@ -14,8 +14,10 @@ ALLIMGS = $(wildcard *.png *.gif *.jpg *.jpeg)
|
||||
|
||||
# Prefix for archive names
|
||||
ARCHIVEPRREFIX =
|
||||
# Additional LaTeX options
|
||||
LATEXOPTS =
|
||||
# Additional LaTeX options (used via latexmkrc/latexmkjarc file)
|
||||
LATEXOPTS = --interaction=nonstopmode
|
||||
# Additional latexmk options
|
||||
LATEXMKOPTS = -f
|
||||
# format: pdf or dvi
|
||||
FMT = pdf
|
||||
|
||||
@ -40,11 +42,11 @@ PDFLATEX = $(LATEX)
|
||||
{% if latex_engine == 'platex' -%}
|
||||
%.dvi: %.tex $(ALLIMGS) FORCE_MAKE
|
||||
for f in *.pdf; do extractbb "$$f"; done
|
||||
$(LATEX) $(LATEXOPTS) '$<'
|
||||
$(LATEX) $(LATEXMKOPTS) '$<'
|
||||
|
||||
{% elif latex_engine != 'xelatex' -%}
|
||||
%.dvi: %.tex FORCE_MAKE
|
||||
$(LATEX) $(LATEXOPTS) '$<'
|
||||
$(LATEX) $(LATEXMKOPTS) '$<'
|
||||
|
||||
{% endif -%}
|
||||
%.ps: %.dvi
|
||||
@ -56,7 +58,9 @@ PDFLATEX = $(LATEX)
|
||||
{%- else -%}
|
||||
%.pdf: %.tex FORCE_MAKE
|
||||
{%- endif %}
|
||||
$(PDFLATEX) $(LATEXOPTS) '$<'
|
||||
$(PDFLATEX) $(LATEXMKOPTS) '$<'
|
||||
|
||||
all: $(ALLPDF)
|
||||
|
||||
all-dvi: $(ALLDVI)
|
||||
|
||||
@ -64,8 +68,6 @@ all-ps: $(ALLPS)
|
||||
|
||||
all-pdf: $(ALLPDF)
|
||||
|
||||
all: $(ALLPDF)
|
||||
|
||||
zip: all-$(FMT)
|
||||
mkdir $(ARCHIVEPREFIX)docs-$(FMT)
|
||||
cp $(ALLPDF) $(ARCHIVEPREFIX)docs-$(FMT)
|
||||
|
@ -1,4 +1,4 @@
|
||||
$latex = 'platex --halt-on-error --interaction=nonstopmode -kanji=utf8 %O %S';
|
||||
$latex = 'platex $LATEXOPTS -kanji=utf8 %O %S';
|
||||
$dvipdf = 'dvipdfmx %O -o %D %S';
|
||||
$makeindex = 'rm -f %D; mendex -U -f -d %B.dic -s python.ist %S || echo "mendex exited with error code $? (ignoring)" && : >> %D';
|
||||
add_cus_dep( "glo", "gls", 0, "makeglo" );
|
||||
|
@ -1,7 +1,7 @@
|
||||
$latex = 'latex --halt-on-error --interaction=nonstopmode %O %S';
|
||||
$pdflatex = 'pdflatex --halt-on-error --interaction=nonstopmode %O %S';
|
||||
$lualatex = 'lualatex --halt-on-error --interaction=nonstopmode %O %S';
|
||||
$xelatex = 'xelatex --no-pdf --halt-on-error --interaction=nonstopmode %O %S';
|
||||
$latex = 'latex $LATEXOPTS %O %S';
|
||||
$pdflatex = 'pdflatex $LATEXOPTS %O %S';
|
||||
$lualatex = 'lualatex $LATEXOPTS %O %S';
|
||||
$xelatex = 'xelatex --no-pdf $LATEXOPTS %O %S';
|
||||
$makeindex = 'makeindex -s python.ist %O -o %D %S';
|
||||
add_cus_dep( "glo", "gls", 0, "makeglo" );
|
||||
sub makeglo {
|
||||
|
@ -6,7 +6,7 @@
|
||||
%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
\ProvidesPackage{sphinx}[2017/04/25 v1.6 LaTeX package (Sphinx markup)]
|
||||
\ProvidesPackage{sphinx}[2017/05/01 v1.6 LaTeX package (Sphinx markup)]
|
||||
|
||||
% provides \ltx@ifundefined
|
||||
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
|
||||
@ -16,15 +16,16 @@
|
||||
|
||||
%% for deprecation warnings
|
||||
\newcommand\sphinxdeprecationwarning[4]{% #1 the deprecated macro or name,
|
||||
% #2 = version when deprecated, #3 = version when removed, #4 = message
|
||||
% #2 = when deprecated, #3 = when removed, #4 = additional info
|
||||
\edef\spx@tempa{\detokenize{#1}}%
|
||||
\ltx@ifundefined{sphinx_depr_\spx@tempa}{%
|
||||
\global\expandafter\let\csname sphinx_depr_\spx@tempa\endcsname\spx@tempa
|
||||
\expandafter\AtEndDocument\expandafter{\expandafter\let\expandafter
|
||||
\sphinxdeprecatedmacro\csname sphinx_depr_\spx@tempa\endcsname
|
||||
\PackageWarningNoLine{sphinx}{^^J**** SPHINX DEPRECATION WARNING:^^J
|
||||
\sphinxdeprecatedmacro\space will be (or has been)
|
||||
deprecated at Sphinx #2^^J and will be removed at Sphinx #3.^^J
|
||||
\sphinxdeprecatedmacro^^J
|
||||
\@spaces- is deprecated at Sphinx #2^^J
|
||||
\@spaces- and removed at Sphinx #3.^^J
|
||||
#4^^J****}}%
|
||||
}{% warning already emitted (at end of latex log), don't repeat
|
||||
}}
|
||||
@ -41,10 +42,29 @@
|
||||
\RequirePackage{textcomp}
|
||||
\RequirePackage{titlesec}
|
||||
\@ifpackagelater{titlesec}{2016/03/15}%
|
||||
{\@ifpackagelater{titlesec}{2016/03/21}{}%
|
||||
{\AtEndDocument{\PackageWarningNoLine{sphinx}{^^J%
|
||||
******** ERROR !! PLEASE UPDATE titlesec.sty !!********^^J%
|
||||
******** THIS VERSION SWALLOWS SECTION NUMBERS.********}}}}{}
|
||||
{\@ifpackagelater{titlesec}{2016/03/21}%
|
||||
{}%
|
||||
{\newif\ifsphinx@ttlpatch@ok
|
||||
\IfFileExists{etoolbox.sty}{%
|
||||
\RequirePackage{etoolbox}%
|
||||
\patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}%
|
||||
{\sphinx@ttlpatch@oktrue}{}%
|
||||
\ifsphinx@ttlpatch@ok
|
||||
\patchcmd{\ttlh@hang}{\noindent}{}{}{\sphinx@ttlpatch@okfalse}%
|
||||
\fi
|
||||
}{}%
|
||||
\ifsphinx@ttlpatch@ok
|
||||
\typeout{^^J Package Sphinx Info: ^^J
|
||||
**** titlesec 2.10.1 successfully patched for bugfix ****^^J}%
|
||||
\else
|
||||
\AtEndDocument{\PackageWarningNoLine{sphinx}{^^J%
|
||||
******** titlesec 2.10.1 has a bug, (section numbers disappear) ......|^^J%
|
||||
******** and Sphinx could not patch it, perhaps because your local ...|^^J%
|
||||
******** copy is already fixed without a changed release date. .......|^^J%
|
||||
******** If not, you must update titlesec! ...........................|}}%
|
||||
\fi
|
||||
}%
|
||||
}{}
|
||||
\RequirePackage{tabulary}
|
||||
% tabulary has a bug with its re-definition of \multicolumn in its first pass
|
||||
% which is not \long. But now Sphinx does not use LaTeX's \multicolumn but its
|
||||
@ -1364,8 +1384,10 @@
|
||||
Anyhow, Sphinx mark-up uses only \string\sphinx\@tempa.}%
|
||||
% and also at end of log for better visibility
|
||||
\expandafter\sphinxdeprecationwarning\expandafter{\csname\@tempa\endcsname}{1.6}{1.7}
|
||||
{\sphinxdeprecatedmacro\space already existed at Sphinx loading time! Not redefined!^^J
|
||||
Sphinx mark-up uses only \string\sphinx\expandafter\@gobble\sphinxdeprecatedmacro.}%
|
||||
{\sphinxdeprecatedmacro already existed at Sphinx loading time! Not redefined!^^J
|
||||
Sphinx mark-up uses only \string\sphinx\expandafter\@gobble\sphinxdeprecatedmacro.^^J
|
||||
Note: if this warning is about macro \string\strong, it presumably results^^J
|
||||
from fontspec 2.6 having defined it prior to Sphinx. No need for alarm!}%
|
||||
}%
|
||||
\fi
|
||||
\sphinxdeprecationwarning{latex_keep_old_macro_names=True}{1.6}{1.7}{}%
|
||||
@ -1387,6 +1409,8 @@
|
||||
\protected\def\sphinxstyleliteralstrong {\sphinxbfcode}
|
||||
\protected\def\sphinxstyleabbreviation {\textsc}
|
||||
\protected\def\sphinxstyleliteralintitle {\sphinxcode}
|
||||
% figure legend comes after caption and may contain arbitrary body elements
|
||||
\newenvironment{sphinxlegend}{\par\small}{\par}
|
||||
|
||||
% Tell TeX about pathological hyphenation cases:
|
||||
\hyphenation{Base-HTTP-Re-quest-Hand-ler}
|
||||
|
@ -116,7 +116,7 @@ class DefaultSubstitutions(SphinxTransform):
|
||||
text = self.config[refname]
|
||||
if refname == 'today' and not text:
|
||||
# special handling: can also specify a strftime format
|
||||
text = format_date(self.config.today_fmt or _('%b %d, %Y'),
|
||||
text = format_date(self.config.today_fmt or _('%b %d, %Y'), # type: ignore
|
||||
language=self.config.language)
|
||||
ref.replace_self(nodes.Text(text, text))
|
||||
|
||||
|
@ -215,12 +215,12 @@ class Locale(SphinxTransform):
|
||||
for child in patch.children:
|
||||
child.parent = node
|
||||
node.children = patch.children
|
||||
node['translated'] = True
|
||||
node['translated'] = True # to avoid double translation
|
||||
|
||||
# phase2: translation
|
||||
for node, msg in extract_messages(self.document):
|
||||
if node.get('translated', False):
|
||||
continue
|
||||
if node.get('translated', False): # to avoid double translation
|
||||
continue # skip if the node is already translated by phase1
|
||||
|
||||
msgstr = catalog.gettext(msg)
|
||||
# XXX add marker to untranslated parts
|
||||
@ -395,7 +395,7 @@ class Locale(SphinxTransform):
|
||||
if isinstance(node, IMAGE_TYPE_NODES):
|
||||
node.update_all_atts(patch)
|
||||
|
||||
node['translated'] = True
|
||||
node['translated'] = True # to avoid double translation
|
||||
|
||||
if 'index' in self.config.gettext_additional_targets:
|
||||
# Extract and translate messages for index entries.
|
||||
@ -415,6 +415,12 @@ class Locale(SphinxTransform):
|
||||
node['raw_entries'] = entries
|
||||
node['entries'] = new_entries
|
||||
|
||||
# remove translated attribute that is used for avoiding double translation.
|
||||
def has_translatable(node):
|
||||
return isinstance(node, nodes.Element) and 'translated' in node
|
||||
for node in self.document.traverse(has_translatable):
|
||||
node.delattr('translated')
|
||||
|
||||
|
||||
class RemoveTranslatableInline(SphinxTransform):
|
||||
"""
|
||||
|
@ -9,9 +9,13 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.utils import get_source_line
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.deprecation import RemovedInSphinx20Warning
|
||||
from sphinx.environment import NoUri
|
||||
from sphinx.locale import _
|
||||
from sphinx.transforms import SphinxTransform
|
||||
@ -27,6 +31,35 @@ if False:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DocReferenceMigrator(SphinxTransform):
|
||||
"""Migrate :doc: reference to std domain."""
|
||||
|
||||
default_priority = 5 # before ReferencesResolver
|
||||
|
||||
def apply(self):
|
||||
# type: () -> None
|
||||
for node in self.document.traverse(addnodes.pending_xref):
|
||||
if node.get('reftype') == 'doc' and node.get('refdomain') is None:
|
||||
source, line = get_source_line(node)
|
||||
if source and line:
|
||||
location = "%s:%s" % (source, line)
|
||||
elif source:
|
||||
location = "%s:" % source
|
||||
elif line:
|
||||
location = "<unknown>:%s" % line
|
||||
else:
|
||||
location = None
|
||||
|
||||
message = ('Invalid pendig_xref node detected. '
|
||||
':doc: reference should have refdomain=std attribute.')
|
||||
if location:
|
||||
warnings.warn("%s: %s" % (location, message),
|
||||
RemovedInSphinx20Warning)
|
||||
else:
|
||||
warnings.warn(message, RemovedInSphinx20Warning)
|
||||
node['refdomain'] = 'std'
|
||||
|
||||
|
||||
class ReferencesResolver(SphinxTransform):
|
||||
"""
|
||||
Resolves cross-references on doctrees.
|
||||
@ -165,6 +198,7 @@ class OnlyNodeTransform(SphinxTransform):
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_post_transform(DocReferenceMigrator)
|
||||
app.add_post_transform(ReferencesResolver)
|
||||
app.add_post_transform(OnlyNodeTransform)
|
||||
|
||||
|
@ -359,7 +359,8 @@ class DocFieldTransformer(object):
|
||||
else:
|
||||
fieldtype, content = entry
|
||||
fieldtypes = types.get(fieldtype.name, {})
|
||||
env = self.directive.state.document.settings.env
|
||||
new_list += fieldtype.make_field(fieldtypes, self.directive.domain,
|
||||
content, env=self.directive.env)
|
||||
content, env=env)
|
||||
|
||||
node.replace_self(new_list)
|
||||
|
@ -51,7 +51,7 @@ def copy_asset_file(source, destination, context=None, renderer=None):
|
||||
if destination.lower().endswith('_t'):
|
||||
destination = destination[:-2]
|
||||
with codecs.open(destination, 'w', encoding='utf-8') as fdst: # type: ignore
|
||||
fdst.write(renderer.render_string(fsrc.read(), context)) # type: ignore
|
||||
fdst.write(renderer.render_string(fsrc.read(), context))
|
||||
else:
|
||||
copyfile(source, destination)
|
||||
|
||||
|
@ -118,5 +118,5 @@ def parse_data_uri(uri):
|
||||
elif prop:
|
||||
mimetype = prop
|
||||
|
||||
image_data = base64.b64decode(data) # type: ignore
|
||||
image_data = base64.b64decode(data)
|
||||
return DataURI(mimetype, charset, image_data)
|
||||
|
@ -88,7 +88,7 @@ class ParallelTasks(object):
|
||||
failed = False
|
||||
except BaseException as err:
|
||||
failed = True
|
||||
errmsg = traceback.format_exception_only(err.__class__, err)[0].strip() # type: ignore # NOQA
|
||||
errmsg = traceback.format_exception_only(err.__class__, err)[0].strip()
|
||||
ret = (errmsg, traceback.format_exc())
|
||||
logging.convert_serializable(collector.logs)
|
||||
pipe.send((failed, collector.logs, ret))
|
||||
|
@ -79,7 +79,7 @@ if PY3:
|
||||
return text_type(tree)
|
||||
else:
|
||||
# no need to refactor on 2.x versions
|
||||
convert_with_2to3 = None # type: ignore
|
||||
convert_with_2to3 = None
|
||||
|
||||
|
||||
# htmlescape()
|
||||
|
@ -120,7 +120,7 @@ def _get_tls_cacert(url, config):
|
||||
certs = getattr(config, 'tls_cacerts', None)
|
||||
if not certs:
|
||||
return True
|
||||
elif isinstance(certs, (string_types, tuple)): # type: ignore
|
||||
elif isinstance(certs, (string_types, tuple)):
|
||||
return certs # type: ignore
|
||||
else:
|
||||
hostname = urlsplit(url)[1]
|
||||
|
@ -7,4 +7,8 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from sphinxcontrib.websupport.utils import is_commentable # NOQA
|
||||
try:
|
||||
from sphinxcontrib.websupport.utils import is_commentable # NOQA
|
||||
except ImportError:
|
||||
def is_commentable(node):
|
||||
raise RuntimeError
|
||||
|
@ -19,9 +19,10 @@ try:
|
||||
from sphinxcontrib.websupport.search import BaseSearch, SEARCH_ADAPTERS # NOQA
|
||||
from sphinxcontrib.websupport.storage import StorageBackend # NOQA
|
||||
|
||||
warnings.warn('sphinx.websupport module is now provided as sphinxcontrib-webuspport. '
|
||||
'sphinx.websupport will be removed in Sphinx-2.0. Please use it instaed',
|
||||
warnings.warn('sphinx.websupport module is now provided as sphinxcontrib-websupport. '
|
||||
'sphinx.websupport will be removed at Sphinx-2.0. '
|
||||
'Please use the package instead.',
|
||||
RemovedInSphinx20Warning)
|
||||
except ImportError:
|
||||
warnings.warn('Since Sphinx-1.6, sphinx.websupport module is now separated to '
|
||||
'sphinxcontrib-webuspport package. Please add it into your dependency list.')
|
||||
'sphinxcontrib-websupport package. Please add it into your dependency list.')
|
||||
|
@ -557,7 +557,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
if builder.config.today:
|
||||
self.elements['date'] = builder.config.today
|
||||
else:
|
||||
self.elements['date'] = format_date(builder.config.today_fmt or _('%b %d, %Y'),
|
||||
self.elements['date'] = format_date(builder.config.today_fmt or _('%b %d, %Y'), # type: ignore # NOQA
|
||||
language=builder.config.language)
|
||||
if builder.config.latex_logo:
|
||||
# no need for \\noindent here, used in flushright
|
||||
@ -1833,12 +1833,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.unrestrict_footnote(node)
|
||||
|
||||
def visit_legend(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
self.body.append('{\\small ')
|
||||
self.body.append('\n\\begin{sphinxlegend}')
|
||||
|
||||
def depart_legend(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
self.body.append('}')
|
||||
self.body.append('\\end{sphinxlegend}\n')
|
||||
|
||||
def visit_admonition(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
|
@ -107,7 +107,7 @@ class ManualPageTranslator(BaseTranslator):
|
||||
if builder.config.today:
|
||||
self._docinfo['date'] = builder.config.today
|
||||
else:
|
||||
self._docinfo['date'] = format_date(builder.config.today_fmt or _('%b %d, %Y'),
|
||||
self._docinfo['date'] = format_date(builder.config.today_fmt or _('%b %d, %Y'), # type: ignore # NOQA
|
||||
language=builder.config.language)
|
||||
self._docinfo['copyright'] = builder.config.copyright
|
||||
self._docinfo['version'] = builder.config.version
|
||||
|
@ -238,7 +238,7 @@ class TexinfoTranslator(nodes.NodeVisitor):
|
||||
'project': self.escape(self.builder.config.project),
|
||||
'copyright': self.escape(self.builder.config.copyright),
|
||||
'date': self.escape(self.builder.config.today or
|
||||
format_date(self.builder.config.today_fmt or _('%b %d, %Y'),
|
||||
format_date(self.builder.config.today_fmt or _('%b %d, %Y'), # type: ignore # NOQA
|
||||
language=self.builder.config.language))
|
||||
})
|
||||
# title
|
||||
|
@ -661,7 +661,7 @@ class TextTranslator(nodes.NodeVisitor):
|
||||
self.add_text(''.join(out) + self.nl)
|
||||
|
||||
def writerow(row):
|
||||
# type: (list[List[unicode]]) -> None
|
||||
# type: (List[List[unicode]]) -> None
|
||||
lines = zip_longest(*row)
|
||||
for line in lines:
|
||||
out = ['|']
|
||||
|
@ -8,6 +8,8 @@ Pygments>=2.0
|
||||
docutils>=0.11
|
||||
snowballstemmer>=1.1
|
||||
babel
|
||||
sqlalchemy>=0.9
|
||||
whoosh>=2.0
|
||||
alabaster
|
||||
sphinx_rtd_theme
|
||||
sphinxcontrib-websupport
|
||||
|
@ -5,6 +5,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
from datetime import datetime
|
||||
from contextlib import contextmanager
|
||||
|
||||
@ -14,17 +15,22 @@ package_dir = os.path.abspath(os.path.join(script_dir, '..'))
|
||||
RELEASE_TYPE = {'a': 'alpha', 'b': 'beta'}
|
||||
|
||||
|
||||
def stringify_version(version_info):
|
||||
def stringify_version(version_info, in_develop=True):
|
||||
if version_info[2] == 0:
|
||||
return '.'.join(str(v) for v in version_info[:2])
|
||||
version = '.'.join(str(v) for v in version_info[:2])
|
||||
else:
|
||||
return '.'.join(str(v) for v in version_info[:3])
|
||||
version = '.'.join(str(v) for v in version_info[:3])
|
||||
|
||||
if not in_develop and version_info[3] != 'final':
|
||||
version += version_info[3][0] + str(version_info[4])
|
||||
|
||||
return version
|
||||
|
||||
|
||||
def bump_version(path, version_info):
|
||||
version = stringify_version(version_info)
|
||||
def bump_version(path, version_info, in_develop=True):
|
||||
version = stringify_version(version_info, in_develop)
|
||||
release = version
|
||||
if version_info[3] != 'final':
|
||||
if in_develop:
|
||||
version += '+'
|
||||
|
||||
with open(path, 'r+') as f:
|
||||
@ -143,19 +149,25 @@ class Changes(object):
|
||||
f.write(body)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print("bump_version.py [version]")
|
||||
return -1
|
||||
def parse_options(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('version', help='A version number (cf. 1.6b0)')
|
||||
parser.add_argument('--in-develop', action='store_true')
|
||||
options = parser.parse_args(argv)
|
||||
options.version = parse_version(options.version)
|
||||
return options
|
||||
|
||||
version_info = parse_version(sys.argv[-1])
|
||||
|
||||
def main():
|
||||
options = parse_options(sys.argv[1:])
|
||||
|
||||
with processing("Rewriting sphinx/__init__.py"):
|
||||
bump_version(os.path.join(package_dir, 'sphinx/__init__.py'), version_info)
|
||||
bump_version(os.path.join(package_dir, 'sphinx/__init__.py'),
|
||||
options.version, options.in_develop)
|
||||
|
||||
with processing('Rewriting CHANGES'):
|
||||
changes = Changes(os.path.join(package_dir, 'CHANGES'))
|
||||
if changes.version_info == version_info:
|
||||
if changes.version_info == options.version:
|
||||
if changes.in_development:
|
||||
changes.finalize_release_date()
|
||||
else:
|
||||
@ -163,7 +175,7 @@ def main():
|
||||
else:
|
||||
if changes.in_development:
|
||||
print('WARNING: last version is not released yet: %s' % changes.version)
|
||||
changes.add_release(version_info)
|
||||
changes.add_release(options.version)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -26,7 +26,7 @@ Release checklist
|
||||
* `git push origin stable --tags`
|
||||
* open https://readthedocs.org/dashboard/sphinx/versions/ and enable the released version
|
||||
* Add new version/milestone to tracker categories
|
||||
* `python utils/bump_version.py a.b.cb0` (ex. 1.5.3b0)
|
||||
* `python utils/bump_version.py --in-develop a.b.cb0` (ex. 1.5.3b0)
|
||||
* Check diff by `git diff`
|
||||
* `git commit -am 'Bump version'`
|
||||
* `git push origin stable`
|
||||
|
Loading…
Reference in New Issue
Block a user