mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-13 17:02:12 -05:00
Merge branch '2.0.1' into 2.0
This commit is contained in:
commit
267e7e5c16
5 files changed
+35
-18
No files matched your search
@@ -78,6 +78,10 @@ Bugs fixed
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* LaTeX: some system labels are not translated
|
* LaTeX: some system labels are not translated
|
||||||
|
* deprecation warnings are not emitted
|
||||||
|
|
||||||
|
- sphinx.application.CONFIG_FILENAME
|
||||||
|
- :confval:`viewcode_import`
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|||||||
+10
-2
@@ -24,9 +24,8 @@ from docutils.parsers.rst import Directive, roles
|
|||||||
import sphinx
|
import sphinx
|
||||||
from sphinx import package_dir, locale
|
from sphinx import package_dir, locale
|
||||||
from sphinx.config import Config
|
from sphinx.config import Config
|
||||||
from sphinx.config import CONFIG_FILENAME # NOQA # for compatibility (RemovedInSphinx30)
|
|
||||||
from sphinx.deprecation import (
|
from sphinx.deprecation import (
|
||||||
RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias
|
||||||
)
|
)
|
||||||
from sphinx.environment import BuildEnvironment
|
from sphinx.environment import BuildEnvironment
|
||||||
from sphinx.errors import ApplicationError, ConfigError, VersionRequirementError
|
from sphinx.errors import ApplicationError, ConfigError, VersionRequirementError
|
||||||
@@ -1252,3 +1251,12 @@ class TemplateBridge:
|
|||||||
specified context (a Python dictionary).
|
specified context (a Python dictionary).
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError('must be implemented in subclasses')
|
raise NotImplementedError('must be implemented in subclasses')
|
||||||
|
|
||||||
|
|
||||||
|
from sphinx.config import CONFIG_FILENAME # NOQA
|
||||||
|
|
||||||
|
deprecated_alias('sphinx.application',
|
||||||
|
{
|
||||||
|
'CONFIG_FILENAME': CONFIG_FILENAME,
|
||||||
|
},
|
||||||
|
RemovedInSphinx30Warning)
|
||||||
@@ -251,6 +251,7 @@ def setup(app):
|
|||||||
app.add_config_value('viewcode_import', None, False)
|
app.add_config_value('viewcode_import', None, False)
|
||||||
app.add_config_value('viewcode_enable_epub', False, False)
|
app.add_config_value('viewcode_enable_epub', False, False)
|
||||||
app.add_config_value('viewcode_follow_imported_members', True, False)
|
app.add_config_value('viewcode_follow_imported_members', True, False)
|
||||||
|
app.connect('config-inited', migrate_viewcode_import)
|
||||||
app.connect('doctree-read', doctree_read)
|
app.connect('doctree-read', doctree_read)
|
||||||
app.connect('env-merge-info', env_merge_info)
|
app.connect('env-merge-info', env_merge_info)
|
||||||
app.connect('html-collect-pages', collect_pages)
|
app.connect('html-collect-pages', collect_pages)
|
||||||
|
|||||||
+13
-9
@@ -21,6 +21,7 @@ from io import StringIO
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
||||||
|
from sphinx.testing.path import path as Path
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@@ -190,15 +191,18 @@ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
|||||||
|
|
||||||
def abspath(pathdir):
|
def abspath(pathdir):
|
||||||
# type: (str) -> str
|
# type: (str) -> str
|
||||||
pathdir = path.abspath(pathdir)
|
if isinstance(pathdir, Path):
|
||||||
if isinstance(pathdir, bytes):
|
return pathdir.abspath()
|
||||||
try:
|
else:
|
||||||
pathdir = pathdir.decode(fs_encoding)
|
pathdir = path.abspath(pathdir)
|
||||||
except UnicodeDecodeError:
|
if isinstance(pathdir, bytes):
|
||||||
raise UnicodeDecodeError('multibyte filename not supported on '
|
try:
|
||||||
'this filesystem encoding '
|
pathdir = pathdir.decode(fs_encoding)
|
||||||
'(%r)' % fs_encoding)
|
except UnicodeDecodeError:
|
||||||
return pathdir
|
raise UnicodeDecodeError('multibyte filename not supported on '
|
||||||
|
'this filesystem encoding '
|
||||||
|
'(%r)' % fs_encoding)
|
||||||
|
return pathdir
|
||||||
|
|
||||||
|
|
||||||
def getcwd():
|
def getcwd():
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ def test_inheritance_diagram_latex_alias(app, status, warning):
|
|||||||
|
|
||||||
|
|
||||||
def test_import_classes(rootdir):
|
def test_import_classes(rootdir):
|
||||||
from sphinx.application import Sphinx, TemplateBridge
|
from sphinx.parsers import Parser, RSTParser
|
||||||
from sphinx.util.i18n import CatalogInfo
|
from sphinx.util.i18n import CatalogInfo
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -120,16 +120,16 @@ def test_import_classes(rootdir):
|
|||||||
assert classes == []
|
assert classes == []
|
||||||
|
|
||||||
# all of classes in the module
|
# all of classes in the module
|
||||||
classes = import_classes('sphinx.application', None)
|
classes = import_classes('sphinx.parsers', None)
|
||||||
assert set(classes) == {Sphinx, TemplateBridge}
|
assert set(classes) == {Parser, RSTParser}
|
||||||
|
|
||||||
# specified class in the module
|
# specified class in the module
|
||||||
classes = import_classes('sphinx.application.Sphinx', None)
|
classes = import_classes('sphinx.parsers.Parser', None)
|
||||||
assert classes == [Sphinx]
|
assert classes == [Parser]
|
||||||
|
|
||||||
# specified class in current module
|
# specified class in current module
|
||||||
classes = import_classes('Sphinx', 'sphinx.application')
|
classes = import_classes('Parser', 'sphinx.parsers')
|
||||||
assert classes == [Sphinx]
|
assert classes == [Parser]
|
||||||
|
|
||||||
# relative module name to current module
|
# relative module name to current module
|
||||||
classes = import_classes('i18n.CatalogInfo', 'sphinx.util')
|
classes = import_classes('i18n.CatalogInfo', 'sphinx.util')
|
||||||
|
|||||||
Reference in new issue
Block a user