Skip to content

Commit

Permalink
Drop APIs deprecated in 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Sep 2, 2018
1 parent bc02abc commit a7cab00
Show file tree
Hide file tree
Showing 37 changed files with 25 additions and 980 deletions.
26 changes: 0 additions & 26 deletions doc/extdev/appapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,6 @@ Emitting events
.. automethod:: emit_firstresult(event, \*arguments)


Producing messages / logging
----------------------------

The application object also provides support for emitting leveled messages.

.. note::

There is no "error" call: in Sphinx, errors are defined as things that stop
the build; just raise an exception (:exc:`sphinx.errors.SphinxError` or a
custom subclass) to do that.

.. deprecated:: 1.6

Please use :ref:`logging-api` instead.

.. automethod:: Sphinx.warn

.. automethod:: Sphinx.info

.. automethod:: Sphinx.verbose

.. automethod:: Sphinx.debug

.. automethod:: Sphinx.debug2


Sphinx runtime information
--------------------------

Expand Down
4 changes: 0 additions & 4 deletions doc/extdev/envapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ Build environment API

**Utility methods**

.. automethod:: warn

.. automethod:: warn_node

.. automethod:: doc2path

.. automethod:: relfn2path
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'requests>=2.0.0',
'setuptools',
'packaging',
'sphinxcontrib-websupport',
]

extras_require = {
Expand Down
46 changes: 0 additions & 46 deletions sphinx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
from __future__ import absolute_import

import os
import sys
import warnings
from os import path

from .deprecation import RemovedInNextVersionWarning
from .deprecation import RemovedInSphinx20Warning

if False:
# For type annotation
Expand Down Expand Up @@ -68,47 +66,3 @@
__display_version__ += '/' + out.decode().strip()
except Exception:
pass


def main(argv=sys.argv): # type: ignore
# type: (List[unicode]) -> int
from .cmd import build
warnings.warn(
'`sphinx.main()` has moved to `sphinx.cmd.build.main()`.',
RemovedInSphinx20Warning,
stacklevel=2,
)
argv = argv[1:] # skip first argument to adjust arguments (refs: #4615)
return build.main(argv)


def build_main(argv=sys.argv):
"""Sphinx build "main" command-line entry."""
from .cmd import build
warnings.warn(
'`sphinx.build_main()` has moved to `sphinx.cmd.build.build_main()`.',
RemovedInSphinx20Warning,
stacklevel=2,
)
return build.build_main(argv[1:]) # skip first argument to adjust arguments (refs: #4615)


def make_main(argv=sys.argv):
"""Sphinx build "make mode" entry."""
from .cmd import build
warnings.warn(
'`sphinx.build_main()` has moved to `sphinx.cmd.build.make_main()`.',
RemovedInSphinx20Warning,
stacklevel=2,
)
return build.make_main(argv[1:]) # skip first argument to adjust arguments (refs: #4615)


if __name__ == '__main__':
from .cmd import build
warnings.warn(
'`sphinx` has moved to `sphinx.build`.',
RemovedInSphinx20Warning,
stacklevel=2,
)
build.main()
41 changes: 0 additions & 41 deletions sphinx/apidoc.py

This file was deleted.

83 changes: 1 addition & 82 deletions sphinx/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from sphinx.config import Config, check_unicode
from sphinx.config import CONFIG_FILENAME # NOQA # for compatibility (RemovedInSphinx30)
from sphinx.deprecation import (
RemovedInSphinx20Warning, RemovedInSphinx30Warning, RemovedInSphinx40Warning
RemovedInSphinx30Warning, RemovedInSphinx40Warning
)
from sphinx.environment import BuildEnvironment
from sphinx.errors import ApplicationError, ConfigError, VersionRequirementError
Expand Down Expand Up @@ -369,72 +369,6 @@ def build(self, force_all=False, filenames=None):
self.emit('build-finished', None)
self.builder.cleanup()

# ---- logging handling ----------------------------------------------------
def warn(self, message, location=None, type=None, subtype=None):
# type: (unicode, unicode, unicode, unicode) -> None
"""Emit a warning.
If *location* is given, it should either be a tuple of (*docname*,
*lineno*) or a string describing the location of the warning as well as
possible.
*type* and *subtype* are used to suppress warnings with
:confval:`suppress_warnings`.
.. deprecated:: 1.6
Use :mod:`sphinx.util.logging` instead.
"""
warnings.warn('app.warning() is now deprecated. Use sphinx.util.logging instead.',
RemovedInSphinx20Warning)
logger.warning(message, type=type, subtype=subtype, location=location)

def info(self, message='', nonl=False):
# type: (unicode, bool) -> None
"""Emit an informational message.
If *nonl* is true, don't emit a newline at the end (which implies that
more info output will follow soon.)
.. deprecated:: 1.6
Use :mod:`sphinx.util.logging` instead.
"""
warnings.warn('app.info() is now deprecated. Use sphinx.util.logging instead.',
RemovedInSphinx20Warning)
logger.info(message, nonl=nonl)

def verbose(self, message, *args, **kwargs):
# type: (unicode, Any, Any) -> None
"""Emit a verbose informational message.
.. deprecated:: 1.6
Use :mod:`sphinx.util.logging` instead.
"""
warnings.warn('app.verbose() is now deprecated. Use sphinx.util.logging instead.',
RemovedInSphinx20Warning)
logger.verbose(message, *args, **kwargs)

def debug(self, message, *args, **kwargs):
# type: (unicode, Any, Any) -> None
"""Emit a debug-level informational message.
.. deprecated:: 1.6
Use :mod:`sphinx.util.logging` instead.
"""
warnings.warn('app.debug() is now deprecated. Use sphinx.util.logging instead.',
RemovedInSphinx20Warning)
logger.debug(message, *args, **kwargs)

def debug2(self, message, *args, **kwargs):
# type: (unicode, Any, Any) -> None
"""Emit a lowlevel debug-level informational message.
.. deprecated:: 1.6
Use :mod:`sphinx.util.logging` instead.
"""
warnings.warn('app.debug2() is now deprecated. Use debug() instead.',
RemovedInSphinx20Warning)
logger.debug(message, *args, **kwargs)

# ---- general extensibility interface -------------------------------------

def setup_extension(self, extname):
Expand Down Expand Up @@ -913,21 +847,6 @@ def add_object_type(self, directivename, rolename, indextemplate='',
ref_nodeclass, objname, doc_field_types,
override=override)

def add_description_unit(self, directivename, rolename, indextemplate='',
parse_node=None, ref_nodeclass=None, objname='',
doc_field_types=[]):
# type: (unicode, unicode, unicode, Callable, nodes.Node, unicode, List) -> None
"""Deprecated alias for :meth:`add_object_type`.
.. deprecated:: 1.6
Use :meth:`add_object_type` instead.
"""
warnings.warn('app.add_description_unit() is now deprecated. '
'Use app.add_object_type() instead.',
RemovedInSphinx20Warning)
self.add_object_type(directivename, rolename, indextemplate, parse_node,
ref_nodeclass, objname, doc_field_types)

def add_crossref_type(self, directivename, rolename, indextemplate='',
ref_nodeclass=None, objname='', override=False):
# type: (unicode, unicode, unicode, nodes.Node, unicode, bool) -> None
Expand Down
20 changes: 0 additions & 20 deletions sphinx/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
"""

import time
import warnings
from os import path

from docutils import nodes
from six.moves import cPickle as pickle

from sphinx.deprecation import RemovedInSphinx20Warning
from sphinx.environment import CONFIG_OK, CONFIG_CHANGED_REASON
from sphinx.environment.adapters.asset import ImageAdapter
from sphinx.errors import SphinxError
Expand Down Expand Up @@ -97,8 +95,6 @@ def __init__(self, app):

self.app = app # type: Sphinx
self.env = None # type: BuildEnvironment
self.warn = app.warn # type: Callable
self.info = app.info # type: Callable
self.config = app.config # type: Config
self.tags = app.tags # type: Tags
self.tags.add(self.format)
Expand Down Expand Up @@ -138,22 +134,6 @@ def create_translator(self, *args):
"""
return self.app.registry.create_translator(self, *args)

@property
def translator_class(self):
# type: () -> Callable[[Any], nodes.NodeVisitor]
"""Return a class of translator.
.. deprecated:: 1.6
"""
translator_class = self.app.registry.get_translator_class(self)
if translator_class is None and self.default_translator_class is None:
warnings.warn('builder.translator_class() is now deprecated. '
'Please use builder.create_translator() and '
'builder.default_translator_class instead.',
RemovedInSphinx20Warning)
return None
return self.create_translator

# helper methods
def init(self):
# type: () -> None
Expand Down
Loading

0 comments on commit a7cab00

Please sign in to comment.