Fix recursive import when importing sphinx.writers.latex directly

This commit is contained in:
Takeshi KOMIYA 2019-01-11 01:57:05 +09:00
parent 90b93dda33
commit 6fc7b0b90d
2 changed files with 21 additions and 35 deletions

View File

@ -1,31 +0,0 @@
"""
sphinx.builders.latex.compat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compatibility module for LaTeX writer.
This module will be removed after deprecation period.
Don't use components in this modules directly.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform
from sphinx.builders.latex.util import ExtBabel
from sphinx.deprecation import (
RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias
)
deprecated_alias('sphinx.writers.latex',
{
'ShowUrlsTransform': ShowUrlsTransform,
'URI_SCHEMES': URI_SCHEMES,
},
RemovedInSphinx30Warning)
deprecated_alias('sphinx.writers.latex',
{
'ExtBabel': ExtBabel,
},
RemovedInSphinx40Warning)

View File

@ -22,10 +22,9 @@ from docutils import nodes, writers
from sphinx import addnodes from sphinx import addnodes
from sphinx import highlighting from sphinx import highlighting
from sphinx.builders.latex.nodes import ( from sphinx.deprecation import (
HYPERLINK_SUPPORT_NODES, captioned_literal_block, footnotetext RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias
) )
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
from sphinx.domains.std import StandardDomain from sphinx.domains.std import StandardDomain
from sphinx.errors import SphinxError from sphinx.errors import SphinxError
from sphinx.locale import admonitionlabels, _, __ from sphinx.locale import admonitionlabels, _, __
@ -2603,4 +2602,22 @@ class LaTeXTranslator(SphinxTranslator):
# Import old modules here for compatibility # Import old modules here for compatibility
import sphinx.builders.latex.compat # NOQA from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform # NOQA
from sphinx.builders.latex.util import ExtBabel # NOQA
deprecated_alias('sphinx.writers.latex',
{
'ShowUrlsTransform': ShowUrlsTransform,
'URI_SCHEMES': URI_SCHEMES,
},
RemovedInSphinx30Warning)
deprecated_alias('sphinx.writers.latex',
{
'ExtBabel': ExtBabel,
},
RemovedInSphinx40Warning)
# FIXME: Workaround to avoid circular import
# refs: https://github.com/sphinx-doc/sphinx/issues/5433
from sphinx.builders.latex.nodes import HYPERLINK_SUPPORT_NODES, captioned_literal_block, footnotetext # NOQA