summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.codecov.yml2
-rw-r--r--CHANGES9
-rw-r--r--sphinx/__init__.py22
-rw-r--r--sphinx/apidoc.py1
-rw-r--r--sphinx/ext/autosummary/__init__.py20
-rw-r--r--sphinx/quickstart.py1
-rw-r--r--sphinx/util/compat.py22
7 files changed, 72 insertions, 5 deletions
diff --git a/.codecov.yml b/.codecov.yml
index aa7a96c27..0e6fdf0c3 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -1,6 +1,6 @@
coverage:
status:
- patch:
+ project:
default:
# allowed to drop X% and still result in a "success" commit status
threshold: 0.05
diff --git a/CHANGES b/CHANGES
index 5aad328b6..396fd9354 100644
--- a/CHANGES
+++ b/CHANGES
@@ -54,6 +54,11 @@ Incompatible changes
Deprecated
----------
+* #4623: ``sphinx.build_main()`` is deprecated. Use
+ ``sphinx.cmd.build.build_main()`` instead.
+* autosummary: The interface of ``sphinx.ext.autosummary.get_documenter()`` has
+ been changed (Since 1.7.0)
+
Features added
--------------
@@ -66,6 +71,10 @@ Bugs fixed
* #4622: epub: :confval:`epub_scheme` does not effect to content.opf
* #4627: graphviz: Fit graphviz images to page
* #4617: quickstart: PROJECT_DIR argument is required
+* #4623: sphinx.build_main no longer exists in 1.7.0
+* #4615: The argument of ``sphinx.build`` has been changed in 1.7.0
+* autosummary: The interface of ``sphinx.ext.autosummary.get_documenter()`` has
+ been changed
Testing
--------
diff --git a/sphinx/__init__.py b/sphinx/__init__.py
index d14a596ad..86bcf88e5 100644
--- a/sphinx/__init__.py
+++ b/sphinx/__init__.py
@@ -15,6 +15,7 @@
from __future__ import absolute_import
import os
+import sys
import warnings
from os import path
@@ -77,9 +78,30 @@ def main(*args, **kwargs):
RemovedInSphinx20Warning,
stacklevel=2,
)
+ args = args[1:] # skip first argument to adjust arguments (refs: #4615)
return build.main(*args, **kwargs)
+def build_main(argv=sys.argv):
+ """Sphinx build "main" command-line entry."""
+ 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."""
+ 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(
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py
index 4a0452044..f397631fb 100644
--- a/sphinx/apidoc.py
+++ b/sphinx/apidoc.py
@@ -28,6 +28,7 @@ def main(*args, **kwargs):
RemovedInSphinx20Warning,
stacklevel=2,
)
+ args = args[1:] # skip first argument to adjust arguments (refs: #4615)
_main(*args, **kwargs)
diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py
index dcd0a4ef7..e0f53956e 100644
--- a/sphinx/ext/autosummary/__init__.py
+++ b/sphinx/ext/autosummary/__init__.py
@@ -58,6 +58,7 @@ import os
import posixpath
import re
import sys
+import warnings
from types import ModuleType
from typing import TYPE_CHECKING
@@ -69,6 +70,7 @@ from six import text_type
import sphinx
from sphinx import addnodes
+from sphinx.deprecation import RemovedInSphinx20Warning
from sphinx.environment.adapters.toctree import TocTree
from sphinx.ext.autodoc import get_documenters
from sphinx.ext.autodoc.directive import DocumenterBridge, Options
@@ -154,14 +156,18 @@ def autosummary_table_visit_html(self, node):
# -- autodoc integration -------------------------------------------------------
+# current application object (used in `get_documenter()`).
+_app = None # type: Sphinx
+
+
class FakeDirective(DocumenterBridge):
def __init__(self):
# type: () -> None
super(FakeDirective, self).__init__({}, None, Options(), 0) # type: ignore
-def get_documenter(app, obj, parent):
- # type: (Sphinx, Any, Any) -> Type[Documenter]
+def get_documenter(*args):
+ # type: (Any) -> Type[Documenter]
"""Get an autodoc.Documenter class suitable for documenting the given
object.
@@ -170,6 +176,16 @@ def get_documenter(app, obj, parent):
belongs to.
"""
from sphinx.ext.autodoc import DataDocumenter, ModuleDocumenter
+ if len(args) == 3:
+ # new style arguments: (app, obj, parent)
+ app, obj, parent = args
+ else:
+ # old style arguments: (obj, parent)
+ app = _app
+ obj, parent = args
+ warnings.warn('the interface of get_documenter() has been changed. '
+ 'Please give application object as first argument.',
+ RemovedInSphinx20Warning)
if inspect.ismodule(obj):
# ModuleDocumenter.can_document_member always returns False
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index 4f38f2b6b..8cad0640b 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -27,6 +27,7 @@ def main(*args, **kwargs):
RemovedInSphinx20Warning,
stacklevel=2,
)
+ args = args[1:] # skip first argument to adjust arguments (refs: #4615)
_main(*args, **kwargs)
diff --git a/sphinx/util/compat.py b/sphinx/util/compat.py
index edd8cac61..c6578c810 100644
--- a/sphinx/util/compat.py
+++ b/sphinx/util/compat.py
@@ -9,15 +9,18 @@
:license: BSD, see LICENSE for details.
"""
+from __future__ import absolute_import
+
+import sys
import warnings
+from typing import TYPE_CHECKING
from six import string_types, iteritems
from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.util import import_object
-if False:
- # For type annotation
+if TYPE_CHECKING:
from typing import Any, Dict # NOQA
from sphinx.application import Sphinx # NOQA
from sphinx.config import Config # NOQA
@@ -35,9 +38,24 @@ def deprecate_source_parsers(app, config):
app.add_source_parser(suffix, parser)
+def register_application_for_autosummary(app):
+ # type: (Sphinx) -> None
+ """Register application object to autosummary module.
+
+ Since Sphinx-1.7, documenters and attrgetters are registered into
+ applicaiton object. As a result, the arguments of
+ ``get_documenter()`` has been changed. To keep compatibility,
+ this handler registers application object to the module.
+ """
+ if 'sphinx.ext.autosummary' in sys.modules:
+ from sphinx.ext import autosummary
+ autosummary._app = app
+
+
def setup(app):
# type: (Sphinx) -> Dict[unicode, Any]
app.connect('config-inited', deprecate_source_parsers)
+ app.connect('builder-inited', register_application_for_autosummary)
return {
'version': 'builtin',