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
|
||||
* Emit several warnings that will be deprecated in Sphinx 1.6.
|
||||
There is no way to hide the warnings.
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
@ -12,6 +12,7 @@
|
||||
import warnings
|
||||
|
||||
from docutils import nodes
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
|
||||
|
||||
class translatable(object):
|
||||
@ -276,12 +277,12 @@ class termsep(nodes.Structural, nodes.Element):
|
||||
"""Separates two terms within a <term> node.
|
||||
|
||||
.. 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):
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
||||
DeprecationWarning, stacklevel=2)
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6',
|
||||
RemovedInSphinx16Warning, stacklevel=2)
|
||||
super(termsep, self).__init__(*args, **kw)
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ import sys
|
||||
import types
|
||||
import posixpath
|
||||
import traceback
|
||||
import warnings
|
||||
from os import path
|
||||
from collections import deque
|
||||
|
||||
@ -32,6 +33,7 @@ from sphinx.roles import XRefRole
|
||||
from sphinx.config import Config
|
||||
from sphinx.errors import SphinxError, SphinxWarning, ExtensionError, \
|
||||
VersionRequirementError, ConfigError
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.domains import ObjType
|
||||
from sphinx.domains.std import GenericObject, Target, StandardDomain
|
||||
from sphinx.environment import BuildEnvironment
|
||||
@ -106,6 +108,8 @@ class Sphinx(object):
|
||||
confoverrides=None, status=sys.stdout, warning=sys.stderr,
|
||||
freshenv=False, warningiserror=False, tags=None, verbosity=0,
|
||||
parallel=0):
|
||||
warnings.filterwarnings('default', category=RemovedInSphinx16Warning,
|
||||
module='sphinx')
|
||||
self.verbosity = verbosity
|
||||
self.next_listener_id = 0
|
||||
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 sphinx.errors import SphinxError
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.util.osutil import walk
|
||||
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):
|
||||
# consider the format as babel's
|
||||
warnings.warn('LDML format support will be dropped at Sphinx-1.5',
|
||||
DeprecationWarning)
|
||||
warnings.warn('LDML format support will be dropped at Sphinx-1.6',
|
||||
RemovedInSphinx16Warning)
|
||||
|
||||
return babel_format_date(date, format, locale=language, warn=warn,
|
||||
formatter=babel.dates.format_datetime)
|
||||
|
@ -15,10 +15,11 @@ import codecs
|
||||
import warnings
|
||||
|
||||
from six import class_types
|
||||
from six import PY3, text_type, exec_
|
||||
from six.moves import zip_longest
|
||||
from itertools import product
|
||||
|
||||
from six import PY3, text_type, exec_
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
|
||||
NoneType = type(None)
|
||||
|
||||
@ -138,9 +139,9 @@ class _DeprecationWrapper(object):
|
||||
def __getattr__(self, attr):
|
||||
if attr in self._deprecated:
|
||||
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,
|
||||
DeprecationWarning, stacklevel=2)
|
||||
RemovedInSphinx16Warning, stacklevel=2)
|
||||
return self._deprecated[attr]
|
||||
return getattr(self._mod, attr)
|
||||
|
||||
|
@ -20,6 +20,7 @@ from docutils import nodes
|
||||
from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.locale import admonitionlabels, _
|
||||
from sphinx.util.images import get_image_size
|
||||
from sphinx.util.smartypants import sphinx_smarty_pants
|
||||
@ -688,8 +689,10 @@ class HTMLTranslator(BaseTranslator):
|
||||
self.body.append('</dd>\n')
|
||||
|
||||
def visit_termsep(self, node):
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
||||
DeprecationWarning)
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||
'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 />')
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
@ -24,6 +24,7 @@ from docutils.writers.latex2e import Babel
|
||||
from sphinx import addnodes
|
||||
from sphinx import highlighting
|
||||
from sphinx.errors import SphinxError
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.locale import admonitionlabels, _
|
||||
from sphinx.util import split_into
|
||||
from sphinx.util.i18n import format_date
|
||||
@ -1339,8 +1340,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.in_term -= 1
|
||||
|
||||
def visit_termsep(self, node):
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
||||
DeprecationWarning)
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||
'This warning is displayed because some Sphinx extension '
|
||||
'uses sphinx.addnodes.termsep. Please report it to '
|
||||
'author of the extension.', RemovedInSphinx16Warning)
|
||||
self.body.append(', ')
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
@ -19,6 +19,7 @@ from docutils.writers.manpage import (
|
||||
)
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.locale import admonitionlabels, _
|
||||
from sphinx.util.compat import docutils_version
|
||||
from sphinx.util.i18n import format_date
|
||||
@ -216,8 +217,10 @@ class ManualPageTranslator(BaseTranslator):
|
||||
BaseTranslator.visit_term(self, node)
|
||||
|
||||
def visit_termsep(self, node):
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
||||
DeprecationWarning)
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||
'This warning is displayed because some Sphinx extension '
|
||||
'uses sphinx.addnodes.termsep. Please report it to '
|
||||
'author of the extension.', RemovedInSphinx16Warning)
|
||||
self.body.append(', ')
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
@ -19,6 +19,7 @@ from six.moves import range
|
||||
from docutils import nodes, writers
|
||||
|
||||
from sphinx import addnodes, __display_version__
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.locale import admonitionlabels, _
|
||||
from sphinx.util.i18n import format_date
|
||||
from sphinx.writers.latex import collected_footnote
|
||||
@ -954,8 +955,10 @@ class TexinfoTranslator(nodes.NodeVisitor):
|
||||
pass
|
||||
|
||||
def visit_termsep(self, node):
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
||||
DeprecationWarning)
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||
'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)
|
||||
|
||||
def depart_termsep(self, node):
|
||||
|
@ -20,6 +20,7 @@ from docutils import nodes, writers
|
||||
from docutils.utils import column_width
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.deprecation import RemovedInSphinx16Warning
|
||||
from sphinx.locale import admonitionlabels, _
|
||||
|
||||
|
||||
@ -651,8 +652,10 @@ class TextTranslator(nodes.NodeVisitor):
|
||||
self.end_state(end=None)
|
||||
|
||||
def visit_termsep(self, node):
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.5',
|
||||
DeprecationWarning)
|
||||
warnings.warn('sphinx.addnodes.termsep will be removed at Sphinx-1.6. '
|
||||
'This warning is displayed because some Sphinx extension '
|
||||
'uses sphinx.addnodes.termsep. Please report it to '
|
||||
'author of the extension.', RemovedInSphinx16Warning)
|
||||
self.add_text(', ')
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user