Merge branch '2.x' into 3.x

This commit is contained in:
Takeshi KOMIYA
2020-02-18 01:42:37 +09:00
5 changed files with 24 additions and 16 deletions

View File

@@ -90,7 +90,10 @@ Bugs fixed
as a value
* #7156: autodoc: separator for keyword only arguments is not shown
* #7146: autodoc: IndexError is raised on suppressed type_comment found
* #7161: autodoc: typehints extension does not support parallel build
* #7151: crashed when extension assigns a value to ``env.indexentries``
* #7170: text: Remove debug print
* #7137: viewcode: Avoid to crash when non-python code given
Testing
--------

View File

@@ -61,7 +61,7 @@ of the core developers before it is merged into the main repository.
#. If you feel uncomfortable or uncertain about an issue or your changes, feel
free to email the *sphinx-dev* mailing list.
#. Fork `the repository`_ on GitHub to start making your changes to the
``master`` branch for next MAJOR version, or ``X.Y`` branch for next
``master`` branch for next MAJOR version, or ``A.x`` branch for next
MINOR version (see `Branch Model`_).
#. Write a test which shows that the bug was fixed or that the feature works
as expected.
@@ -94,10 +94,10 @@ These are the basic steps needed to start developing on Sphinx.
Sphinx adopts Semantic Versioning 2.0.0 (refs: https://semver.org/ ).
For changes that preserves backwards-compatibility of API and features,
they should be included in the next MINOR release, use the ``X.Y`` branch.
they should be included in the next MINOR release, use the ``A.x`` branch.
::
git checkout X.Y
git checkout A.x
For incompatible or other substantial changes that should wait until the
next MAJOR release, use the ``master`` branch.
@@ -199,7 +199,7 @@ These are the basic steps needed to start developing on Sphinx.
git push origin feature-xyz
#. Submit a pull request from your branch to the respective branch (``master``
or ``X.Y``).
or ``A.x``).
#. Wait for a core developer to review your changes.
@@ -325,8 +325,8 @@ Versioning 2.0.0 (refs: https://semver.org/ ).
All changes including incompatible behaviors and public API updates are
allowed.
``X.Y``
Where ``X.Y`` is the ``MAJOR.MINOR`` release. Used to maintain current
``A.x`` (ex. ``2.x``)
Where ``A.x`` is the ``MAJOR.MINOR`` release. Used to maintain current
MINOR release. All changes are allowed if the change preserves
backwards-compatibility of API and features.
@@ -334,8 +334,8 @@ Versioning 2.0.0 (refs: https://semver.org/ ).
new MAJOR version is released, the old ``MAJOR.MINOR`` branch will be
deleted and replaced by an equivalent tag.
``X.Y.Z``
Where ``X.Y.Z`` is the ``MAJOR.MINOR.PATCH`` release. Only
``A.B.x`` (ex. ``2.4.x``)
Where ``A.B.x`` is the ``MAJOR.MINOR.PATCH`` release. Only
backwards-compatible bug fixes are allowed. In Sphinx project, PATCH
version is used for urgent bug fix.

View File

@@ -18,19 +18,19 @@ from docutils.nodes import Element
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.config import ENUM
from sphinx.config import Config, ENUM
from sphinx.util import inspect, typing
def config_inited(app, config):
def config_inited(app: Sphinx, config: Config) -> None:
if config.autodoc_typehints == 'description':
# HACK: override this to make autodoc suppressing typehints in signatures
config.autodoc_typehints = 'none'
config.autodoc_typehints = 'none' # type: ignore
# preserve user settings
app._autodoc_typehints_description = True
app._autodoc_typehints_description = True # type: ignore
else:
app._autodoc_typehints_description = False
app._autodoc_typehints_description = False # type: ignore
def record_typehints(app: Sphinx, objtype: str, name: str, obj: Any,
@@ -140,10 +140,16 @@ def modify_field_list(node: nodes.field_list, annotations: Dict[str, str]) -> No
node += field
def setup(app):
def setup(app: Sphinx) -> Dict[str, Any]:
app.setup_extension('sphinx.ext.autodoc')
app.config.values['autodoc_typehints'] = ('signature', True,
ENUM("signature", "description", "none"))
app.connect('config-inited', config_inited)
app.connect('autodoc-process-signature', record_typehints)
app.connect('object-description-transform', merge_typehints)
return {
'version': 'builtin',
'parallel_read_safe': True,
'parallel_write_safe': True,
}

View File

@@ -63,11 +63,11 @@ def doctree_read(app: Sphinx, doctree: Node) -> None:
if code_tags is None:
try:
analyzer = ModuleAnalyzer.for_module(modname)
analyzer.find_tags()
except Exception:
env._viewcode_modules[modname] = False # type: ignore
return False
analyzer.find_tags()
code = analyzer.code
tags = analyzer.tags
else:

View File

@@ -916,7 +916,6 @@ class TextTranslator(SphinxTranslator):
def _depart_admonition(self, node: Element) -> None:
label = admonitionlabels[node.tagname]
indent = sum(self.stateindent) + len(label)
print(self.states[-1])
if (len(self.states[-1]) == 1 and
self.states[-1][0][0] == 0 and
MAXWIDTH - indent >= sum(len(s) for s in self.states[-1][0][1])):