Merge branch 'master' into add_override_option

This commit is contained in:
Takeshi KOMIYA 2018-03-29 22:03:05 +09:00
commit 72a0896bd0
12 changed files with 38 additions and 25 deletions

View File

@ -32,6 +32,7 @@ Deprecated
deprecated
* ``sphinx.locale.l_()`` is deprecated
* #2157: helper function ``warn()`` for HTML themes is deprecated
* ``env._nitpick_ignore`` is deprecated
* ``app.override_domain()`` is deprecated
For more details, see `deprecation APIs list

View File

@ -118,6 +118,11 @@ The following is a list of deprecated interface.
- 3.0
- :meth:`~sphinx.application.Sphinx.add_domain()`
* - ``BuildEnvironment._nitpick_ignore``
- 1.8
- 3.0
- :confval:`nitpick_ignore`
* - ``warn()`` (template helper function)
- 1.8
- 3.0

View File

@ -10,12 +10,12 @@
"""
import warnings
from typing import TYPE_CHECKING
from sphinx.deprecation import RemovedInSphinx20Warning
from sphinx.ext.apidoc import main as _main
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any # NOQA
from sphinx.application import Sphinx # NOQA

View File

@ -532,9 +532,6 @@ class BuildEnvironment(object):
self.config = config
self._update_settings(config)
# this cache also needs to be updated every time
self._nitpick_ignore = set(self.config.nitpick_ignore)
# return tuple of (changed, reason)
return bool(changed_reason), changed_reason
@ -864,3 +861,11 @@ class BuildEnvironment(object):
warnings.warn('env._read_parallel() is deprecated. Please use builder.read() instead.',
RemovedInSphinx30Warning)
return self.app.builder._read_parallel(docnames, nproc)
@property
def _nitpick_ignore(self):
# type: () -> List[unicode]
warnings.warn('env._nitpick_ignore is deprecated. '
'Please use config.nitpick_ignore instead.',
RemovedInSphinx30Warning)
return self.config.nitpick_ignore

View File

@ -24,15 +24,14 @@
:license: BSD, see LICENSE for details.
"""
from typing import TYPE_CHECKING
from docutils import nodes, utils
from six import iteritems
import sphinx
from sphinx.util.nodes import split_explicit_title
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any, Dict, List, Tuple # NOQA
from docutils.parsers.rst.states import Inliner # NOQA
from sphinx.application import Sphinx # NOQA

View File

@ -10,11 +10,11 @@
"""
import os
from typing import TYPE_CHECKING
import sphinx
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any, Dict # NOQA
from sphinx.application import Sphinx # NOQA
from sphinx.environment import BuildEnvironment # NOQA

View File

@ -10,8 +10,6 @@
:license: BSD, see LICENSE for details.
"""
from typing import TYPE_CHECKING
from docutils import nodes
import sphinx
@ -20,8 +18,8 @@ from sphinx.ext.mathbase import get_node_equation_number
from sphinx.ext.mathbase import setup_math as mathbase_setup
from sphinx.locale import _
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any, Dict # NOQA
from sphinx.application import Sphinx # NOQA

View File

@ -11,8 +11,6 @@
:license: BSD, see LICENSE for details.
"""
from typing import TYPE_CHECKING
from docutils import nodes
import sphinx
@ -21,7 +19,8 @@ from sphinx.ext.mathbase import get_node_equation_number
from sphinx.ext.mathbase import setup_math as mathbase_setup
from sphinx.locale import _
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any, Dict # NOQA
from sphinx.application import Sphinx # NOQA

View File

@ -253,7 +253,13 @@ def init_console(locale_dir, catalog):
.. versionadded:: 1.8
"""
language, _ = locale.getlocale(locale.LC_MESSAGES) # encoding is ignored
try:
# encoding is ignored
language, _ = locale.getlocale(locale.LC_MESSAGES)
except AttributeError:
# LC_MESSAGES is not always defined. Fallback to the default language
# in case it is not.
language = None
return init([locale_dir], language, catalog, 'console')

View File

@ -10,12 +10,12 @@
"""
import warnings
from typing import TYPE_CHECKING
from sphinx.cmd.quickstart import main as _main
from sphinx.deprecation import RemovedInSphinx20Warning
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any # NOQA

View File

@ -10,11 +10,11 @@ import os
import shutil
import sys
from io import open
from typing import TYPE_CHECKING
from six import PY2, text_type
if TYPE_CHECKING:
if False:
# For type annotation
from typing import Any, Callable, IO, List # NOQA

View File

@ -156,13 +156,13 @@ class ReferencesResolver(SphinxTransform):
warn = node.get('refwarn')
if self.config.nitpicky:
warn = True
if self.env._nitpick_ignore:
if self.config.nitpick_ignore:
dtype = domain and '%s:%s' % (domain.name, typ) or typ
if (dtype, target) in self.env._nitpick_ignore:
if (dtype, target) in self.config.nitpick_ignore:
warn = False
# for "std" types also try without domain name
if (not domain or domain.name == 'std') and \
(typ, target) in self.env._nitpick_ignore:
(typ, target) in self.config.nitpick_ignore:
warn = False
if not warn:
return