summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--doc/extdev/index.rst5
-rw-r--r--doc/setuptools.rst2
-rw-r--r--sphinx/apidoc.py4
-rw-r--r--sphinx/environment/__init__.py11
-rw-r--r--sphinx/ext/extlinks.py5
-rw-r--r--sphinx/ext/githubpages.py4
-rw-r--r--sphinx/ext/jsmath.py6
-rw-r--r--sphinx/ext/mathjax.py5
-rw-r--r--sphinx/locale/__init__.py8
-rw-r--r--sphinx/quickstart.py4
-rw-r--r--sphinx/testing/path.py4
-rw-r--r--sphinx/transforms/post_transforms/__init__.py6
13 files changed, 39 insertions, 26 deletions
diff --git a/CHANGES b/CHANGES
index ccab93722..11f62c501 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
* ``Config.__init__()`` has changed; the *dirname*, *filename* and *tags*
argument has been deprecated
* ``Config.check_types()`` is deprecated
diff --git a/doc/extdev/index.rst b/doc/extdev/index.rst
index a3b880deb..bc79394cc 100644
--- a/doc/extdev/index.rst
+++ b/doc/extdev/index.rst
@@ -124,6 +124,11 @@ The following is a list of deprecated interface.
- 3.0
- ``Config.read()``
+ * - ``BuildEnvironment._nitpick_ignore``
+ - 1.8
+ - 3.0
+ - :confval:`nitpick_ignore`
+
* - ``warn()`` (template helper function)
- 1.8
- 3.0
diff --git a/doc/setuptools.rst b/doc/setuptools.rst
index 8d759f985..10f732559 100644
--- a/doc/setuptools.rst
+++ b/doc/setuptools.rst
@@ -62,7 +62,7 @@ Options for setuptools integration
A boolean that determines whether the saved environment should be discarded
on build. Default is false.
- This can also be set by passing the `-E` flag to ``setup.py``.
+ This can also be set by passing the `-E` flag to ``setup.py``:
.. code-block:: bash
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py
index f6616e497..dffa4a9ef 100644
--- a/sphinx/apidoc.py
+++ b/sphinx/apidoc.py
@@ -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
diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py
index 461fc1227..34c99a1f5 100644
--- a/sphinx/environment/__init__.py
+++ b/sphinx/environment/__init__.py
@@ -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
diff --git a/sphinx/ext/extlinks.py b/sphinx/ext/extlinks.py
index 53b051c45..29bfe928f 100644
--- a/sphinx/ext/extlinks.py
+++ b/sphinx/ext/extlinks.py
@@ -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
diff --git a/sphinx/ext/githubpages.py b/sphinx/ext/githubpages.py
index f97c810f8..bd7061fb7 100644
--- a/sphinx/ext/githubpages.py
+++ b/sphinx/ext/githubpages.py
@@ -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
diff --git a/sphinx/ext/jsmath.py b/sphinx/ext/jsmath.py
index ffa36969d..a25e271b0 100644
--- a/sphinx/ext/jsmath.py
+++ b/sphinx/ext/jsmath.py
@@ -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
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py
index 9f8013b2b..e3f7afebe 100644
--- a/sphinx/ext/mathjax.py
+++ b/sphinx/ext/mathjax.py
@@ -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
diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py
index b0bf0ead1..b17da28e9 100644
--- a/sphinx/locale/__init__.py
+++ b/sphinx/locale/__init__.py
@@ -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')
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index dbdfb47c1..8cad0640b 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -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
diff --git a/sphinx/testing/path.py b/sphinx/testing/path.py
index 5f59ad30b..209046246 100644
--- a/sphinx/testing/path.py
+++ b/sphinx/testing/path.py
@@ -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
diff --git a/sphinx/transforms/post_transforms/__init__.py b/sphinx/transforms/post_transforms/__init__.py
index 7c71e8585..6e53fec1d 100644
--- a/sphinx/transforms/post_transforms/__init__.py
+++ b/sphinx/transforms/post_transforms/__init__.py
@@ -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