mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Show deprecation warning for sphinx.application.CONFIG_FILENAME
This commit is contained in:
parent
765a92b99b
commit
bd903c8904
3
CHANGES
3
CHANGES
@ -17,6 +17,9 @@ Bugs fixed
|
||||
----------
|
||||
|
||||
* LaTeX: some system labels are not translated
|
||||
* deprecation warnings are not emitted
|
||||
|
||||
- sphinx.application.CONFIG_FILENAME
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -24,9 +24,8 @@ from docutils.parsers.rst import Directive, roles
|
||||
import sphinx
|
||||
from sphinx import package_dir, locale
|
||||
from sphinx.config import Config
|
||||
from sphinx.config import CONFIG_FILENAME # NOQA # for compatibility (RemovedInSphinx30)
|
||||
from sphinx.deprecation import (
|
||||
RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
||||
RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias
|
||||
)
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.errors import ApplicationError, ConfigError, VersionRequirementError
|
||||
@ -1247,3 +1246,12 @@ class TemplateBridge:
|
||||
specified context (a Python dictionary).
|
||||
"""
|
||||
raise NotImplementedError('must be implemented in subclasses')
|
||||
|
||||
|
||||
from sphinx.config import CONFIG_FILENAME # NOQA
|
||||
|
||||
deprecated_alias('sphinx.application',
|
||||
{
|
||||
'CONFIG_FILENAME': CONFIG_FILENAME,
|
||||
},
|
||||
RemovedInSphinx30Warning)
|
||||
|
@ -21,6 +21,7 @@ from io import StringIO
|
||||
from os import path
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
||||
from sphinx.testing.path import path as Path
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
@ -190,15 +191,18 @@ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
||||
|
||||
def abspath(pathdir):
|
||||
# type: (str) -> str
|
||||
pathdir = path.abspath(pathdir)
|
||||
if isinstance(pathdir, bytes):
|
||||
try:
|
||||
pathdir = pathdir.decode(fs_encoding)
|
||||
except UnicodeDecodeError:
|
||||
raise UnicodeDecodeError('multibyte filename not supported on '
|
||||
'this filesystem encoding '
|
||||
'(%r)' % fs_encoding)
|
||||
return pathdir
|
||||
if isinstance(pathdir, Path):
|
||||
return pathdir.abspath()
|
||||
else:
|
||||
pathdir = path.abspath(pathdir)
|
||||
if isinstance(pathdir, bytes):
|
||||
try:
|
||||
pathdir = pathdir.decode(fs_encoding)
|
||||
except UnicodeDecodeError:
|
||||
raise UnicodeDecodeError('multibyte filename not supported on '
|
||||
'this filesystem encoding '
|
||||
'(%r)' % fs_encoding)
|
||||
return pathdir
|
||||
|
||||
|
||||
def getcwd():
|
||||
|
@ -90,7 +90,7 @@ def test_inheritance_diagram_latex_alias(app, status, warning):
|
||||
|
||||
|
||||
def test_import_classes(rootdir):
|
||||
from sphinx.application import Sphinx, TemplateBridge
|
||||
from sphinx.parsers import Parser, RSTParser
|
||||
from sphinx.util.i18n import CatalogInfo
|
||||
|
||||
try:
|
||||
@ -120,16 +120,16 @@ def test_import_classes(rootdir):
|
||||
assert classes == []
|
||||
|
||||
# all of classes in the module
|
||||
classes = import_classes('sphinx.application', None)
|
||||
assert set(classes) == {Sphinx, TemplateBridge}
|
||||
classes = import_classes('sphinx.parsers', None)
|
||||
assert set(classes) == {Parser, RSTParser}
|
||||
|
||||
# specified class in the module
|
||||
classes = import_classes('sphinx.application.Sphinx', None)
|
||||
assert classes == [Sphinx]
|
||||
classes = import_classes('sphinx.parsers.Parser', None)
|
||||
assert classes == [Parser]
|
||||
|
||||
# specified class in current module
|
||||
classes = import_classes('Sphinx', 'sphinx.application')
|
||||
assert classes == [Sphinx]
|
||||
classes = import_classes('Parser', 'sphinx.parsers')
|
||||
assert classes == [Parser]
|
||||
|
||||
# relative module name to current module
|
||||
classes = import_classes('i18n.CatalogInfo', 'sphinx.util')
|
||||
|
Loading…
Reference in New Issue
Block a user