mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Emit several warnings that will be deprecated in Sphinx 1.6. There is no way to hide the warnings.
This commit is contained in:
parent
61a6ca5b37
commit
816b1db93d
2
CHANGES
2
CHANGES
@ -5,6 +5,8 @@ Incompatible changes
|
|||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
* #2986: ``themes/basic/defindex.html`` is now deprecated
|
* #2986: ``themes/basic/defindex.html`` is now deprecated
|
||||||
|
* Emit several warnings that will be deprecated in Sphinx 1.6.
|
||||||
|
There is no way to hide the warnings.
|
||||||
|
|
||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
|
|
||||||
|
|
||||||
class translatable(object):
|
class translatable(object):
|
||||||
@ -276,12 +277,12 @@ class termsep(nodes.Structural, nodes.Element):
|
|||||||
"""Separates two terms within a <term> node.
|
"""Separates two terms within a <term> node.
|
||||||
|
|
||||||
.. versionchanged:: 1.4
|
.. versionchanged:: 1.4
|
||||||
sphinx.addnodes.termsep is deprecated. It will be removed at Sphinx-1.5.
|
sphinx.addnodes.termsep is deprecated. It will be removed at Sphinx-1.6.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6',
|
||||||
DeprecationWarning, stacklevel=2)
|
RemovedInSphinx16Warning, stacklevel=2)
|
||||||
super(termsep, self).__init__(*args, **kw)
|
super(termsep, self).__init__(*args, **kw)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import sys
|
|||||||
import types
|
import types
|
||||||
import posixpath
|
import posixpath
|
||||||
import traceback
|
import traceback
|
||||||
|
import warnings
|
||||||
from os import path
|
from os import path
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ from sphinx.roles import XRefRole
|
|||||||
from sphinx.config import Config
|
from sphinx.config import Config
|
||||||
from sphinx.errors import SphinxError, SphinxWarning, ExtensionError, \
|
from sphinx.errors import SphinxError, SphinxWarning, ExtensionError, \
|
||||||
VersionRequirementError, ConfigError
|
VersionRequirementError, ConfigError
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.domains import ObjType
|
from sphinx.domains import ObjType
|
||||||
from sphinx.domains.std import GenericObject, Target, StandardDomain
|
from sphinx.domains.std import GenericObject, Target, StandardDomain
|
||||||
from sphinx.environment import BuildEnvironment
|
from sphinx.environment import BuildEnvironment
|
||||||
@ -106,6 +108,8 @@ class Sphinx(object):
|
|||||||
confoverrides=None, status=sys.stdout, warning=sys.stderr,
|
confoverrides=None, status=sys.stdout, warning=sys.stderr,
|
||||||
freshenv=False, warningiserror=False, tags=None, verbosity=0,
|
freshenv=False, warningiserror=False, tags=None, verbosity=0,
|
||||||
parallel=0):
|
parallel=0):
|
||||||
|
warnings.filterwarnings('default', category=RemovedInSphinx16Warning,
|
||||||
|
module='sphinx')
|
||||||
self.verbosity = verbosity
|
self.verbosity = verbosity
|
||||||
self.next_listener_id = 0
|
self.next_listener_id = 0
|
||||||
self._extensions = {}
|
self._extensions = {}
|
||||||
|
21
sphinx/deprecation.py
Normal file
21
sphinx/deprecation.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
sphinx.deprecation
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Sphinx deprecation classes and utilities.
|
||||||
|
|
||||||
|
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
|
||||||
|
:license: BSD, see LICENSE for details.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class RemovedInSphinx16Warning(DeprecationWarning):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class RemovedInSphinx17Warning(PendingDeprecationWarning):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
RemovedInNextVersionWarning = RemovedInSphinx16Warning
|
@ -22,6 +22,7 @@ from babel.messages.pofile import read_po
|
|||||||
from babel.messages.mofile import write_mo
|
from babel.messages.mofile import write_mo
|
||||||
|
|
||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import SphinxError
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.util.osutil import walk
|
from sphinx.util.osutil import walk
|
||||||
from sphinx.util import SEP
|
from sphinx.util import SEP
|
||||||
|
|
||||||
@ -194,8 +195,8 @@ def format_date(format, date=None, language=None, warn=None):
|
|||||||
|
|
||||||
if re.match('EEE|MMM|dd|DDD|MM|WW|medium|YY', format):
|
if re.match('EEE|MMM|dd|DDD|MM|WW|medium|YY', format):
|
||||||
# consider the format as babel's
|
# consider the format as babel's
|
||||||
warnings.warn('LDML format support will be dropped at Sphinx-1.5',
|
warnings.warn('LDML format support will be dropped at Sphinx-1.6',
|
||||||
DeprecationWarning)
|
RemovedInSphinx16Warning)
|
||||||
|
|
||||||
return babel_format_date(date, format, locale=language, warn=warn,
|
return babel_format_date(date, format, locale=language, warn=warn,
|
||||||
formatter=babel.dates.format_datetime)
|
formatter=babel.dates.format_datetime)
|
||||||
|
@ -15,10 +15,11 @@ import codecs
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from six import class_types
|
from six import class_types
|
||||||
|
from six import PY3, text_type, exec_
|
||||||
from six.moves import zip_longest
|
from six.moves import zip_longest
|
||||||
from itertools import product
|
from itertools import product
|
||||||
|
|
||||||
from six import PY3, text_type, exec_
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
|
|
||||||
NoneType = type(None)
|
NoneType = type(None)
|
||||||
|
|
||||||
@ -138,9 +139,9 @@ class _DeprecationWrapper(object):
|
|||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
if attr in self._deprecated:
|
if attr in self._deprecated:
|
||||||
warnings.warn("sphinx.util.pycompat.%s is deprecated and will be "
|
warnings.warn("sphinx.util.pycompat.%s is deprecated and will be "
|
||||||
"removed in Sphinx 1.4, please use the standard "
|
"removed in Sphinx 1.6, please use the standard "
|
||||||
"library version instead." % attr,
|
"library version instead." % attr,
|
||||||
DeprecationWarning, stacklevel=2)
|
RemovedInSphinx16Warning, stacklevel=2)
|
||||||
return self._deprecated[attr]
|
return self._deprecated[attr]
|
||||||
return getattr(self._mod, attr)
|
return getattr(self._mod, attr)
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ from docutils import nodes
|
|||||||
from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator
|
from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.locale import admonitionlabels, _
|
from sphinx.locale import admonitionlabels, _
|
||||||
from sphinx.util.images import get_image_size
|
from sphinx.util.images import get_image_size
|
||||||
from sphinx.util.smartypants import sphinx_smarty_pants
|
from sphinx.util.smartypants import sphinx_smarty_pants
|
||||||
@ -688,8 +689,10 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
self.body.append('</dd>\n')
|
self.body.append('</dd>\n')
|
||||||
|
|
||||||
def visit_termsep(self, node):
|
def visit_termsep(self, node):
|
||||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||||
DeprecationWarning)
|
'This warning is displayed because some Sphinx extension '
|
||||||
|
'uses sphinx.addnodes.termsep. Please report it to '
|
||||||
|
'author of the extension.', RemovedInSphinx16Warning)
|
||||||
self.body.append('<br />')
|
self.body.append('<br />')
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ from docutils.writers.latex2e import Babel
|
|||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx import highlighting
|
from sphinx import highlighting
|
||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import SphinxError
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.locale import admonitionlabels, _
|
from sphinx.locale import admonitionlabels, _
|
||||||
from sphinx.util import split_into
|
from sphinx.util import split_into
|
||||||
from sphinx.util.i18n import format_date
|
from sphinx.util.i18n import format_date
|
||||||
@ -1339,8 +1340,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.in_term -= 1
|
self.in_term -= 1
|
||||||
|
|
||||||
def visit_termsep(self, node):
|
def visit_termsep(self, node):
|
||||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||||
DeprecationWarning)
|
'This warning is displayed because some Sphinx extension '
|
||||||
|
'uses sphinx.addnodes.termsep. Please report it to '
|
||||||
|
'author of the extension.', RemovedInSphinx16Warning)
|
||||||
self.body.append(', ')
|
self.body.append(', ')
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ from docutils.writers.manpage import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.locale import admonitionlabels, _
|
from sphinx.locale import admonitionlabels, _
|
||||||
from sphinx.util.compat import docutils_version
|
from sphinx.util.compat import docutils_version
|
||||||
from sphinx.util.i18n import format_date
|
from sphinx.util.i18n import format_date
|
||||||
@ -216,8 +217,10 @@ class ManualPageTranslator(BaseTranslator):
|
|||||||
BaseTranslator.visit_term(self, node)
|
BaseTranslator.visit_term(self, node)
|
||||||
|
|
||||||
def visit_termsep(self, node):
|
def visit_termsep(self, node):
|
||||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||||
DeprecationWarning)
|
'This warning is displayed because some Sphinx extension '
|
||||||
|
'uses sphinx.addnodes.termsep. Please report it to '
|
||||||
|
'author of the extension.', RemovedInSphinx16Warning)
|
||||||
self.body.append(', ')
|
self.body.append(', ')
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ from six.moves import range
|
|||||||
from docutils import nodes, writers
|
from docutils import nodes, writers
|
||||||
|
|
||||||
from sphinx import addnodes, __display_version__
|
from sphinx import addnodes, __display_version__
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.locale import admonitionlabels, _
|
from sphinx.locale import admonitionlabels, _
|
||||||
from sphinx.util.i18n import format_date
|
from sphinx.util.i18n import format_date
|
||||||
from sphinx.writers.latex import collected_footnote
|
from sphinx.writers.latex import collected_footnote
|
||||||
@ -954,8 +955,10 @@ class TexinfoTranslator(nodes.NodeVisitor):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def visit_termsep(self, node):
|
def visit_termsep(self, node):
|
||||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||||
DeprecationWarning)
|
'This warning is displayed because some Sphinx extension '
|
||||||
|
'uses sphinx.addnodes.termsep. Please report it to '
|
||||||
|
'author of the extension.', RemovedInSphinx16Warning)
|
||||||
self.body.append('\n%s ' % self.at_item_x)
|
self.body.append('\n%s ' % self.at_item_x)
|
||||||
|
|
||||||
def depart_termsep(self, node):
|
def depart_termsep(self, node):
|
||||||
|
@ -20,6 +20,7 @@ from docutils import nodes, writers
|
|||||||
from docutils.utils import column_width
|
from docutils.utils import column_width
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
|
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||||
from sphinx.locale import admonitionlabels, _
|
from sphinx.locale import admonitionlabels, _
|
||||||
|
|
||||||
|
|
||||||
@ -651,8 +652,10 @@ class TextTranslator(nodes.NodeVisitor):
|
|||||||
self.end_state(end=None)
|
self.end_state(end=None)
|
||||||
|
|
||||||
def visit_termsep(self, node):
|
def visit_termsep(self, node):
|
||||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||||
DeprecationWarning)
|
'This warning is displayed because some Sphinx extension '
|
||||||
|
'uses sphinx.addnodes.termsep. Please report it to '
|
||||||
|
'author of the extension.', RemovedInSphinx16Warning)
|
||||||
self.add_text(', ')
|
self.add_text(', ')
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user