Deprecate env._nitpick_ignore

This commit is contained in:
Takeshi KOMIYA 2018-02-23 14:01:11 +09:00
parent 5734d8ad02
commit 0f3fa689a4
4 changed files with 17 additions and 6 deletions

View File

@ -32,6 +32,7 @@ Deprecated
deprecated deprecated
* ``sphinx.locale.l_()`` is deprecated * ``sphinx.locale.l_()`` is deprecated
* #2157: helper function ``warn()`` for HTML themes is deprecated * #2157: helper function ``warn()`` for HTML themes is deprecated
* ``env._nitpick_ignore`` is deprecated
For more details, see `deprecation APIs list For more details, see `deprecation APIs list
<http://www.sphinx-doc.org/en/master/extdev/index.html#deprecated-apis>`_ <http://www.sphinx-doc.org/en/master/extdev/index.html#deprecated-apis>`_

View File

@ -113,6 +113,11 @@ The following is a list of deprecated interface.
- (will be) Removed - (will be) Removed
- Alternatives - Alternatives
* - ``BuildEnvironment._nitpick_ignore``
- 1.8
- 3.0
- :confval:`nitpick_ignore`
* - ``warn()`` (template helper function) * - ``warn()`` (template helper function)
- 1.8 - 1.8
- 3.0 - 3.0

View File

@ -532,9 +532,6 @@ class BuildEnvironment(object):
self.config = config self.config = config
self._update_settings(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 tuple of (changed, reason)
return bool(changed_reason), 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.', warnings.warn('env._read_parallel() is deprecated. Please use builder.read() instead.',
RemovedInSphinx30Warning) RemovedInSphinx30Warning)
return self.app.builder._read_parallel(docnames, nproc) 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

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