diff --git a/CHANGES b/CHANGES index d95a4026f..95cc16a5a 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Bugs fixed * #5418: Incorrect default path for sphinx-build -d/doctrees files * #5421: autodoc emits deprecation warning for :confval:`autodoc_default_flags` * #5422: lambda object causes PicklingError on storing environment +* #5433: latex: ImportError: cannot import name 'DEFAULT_SETTINGS' Testing -------- diff --git a/sphinx/builders/latex/nodes.py b/sphinx/builders/latex/nodes.py index 32ac7c6a0..2dfba1b57 100644 --- a/sphinx/builders/latex/nodes.py +++ b/sphinx/builders/latex/nodes.py @@ -35,3 +35,12 @@ class math_reference(nodes.Inline, nodes.Referential, nodes.TextElement): class thebibliography(nodes.container): """A node for wrapping bibliographies.""" pass + + +HYPERLINK_SUPPORT_NODES = ( + nodes.figure, + nodes.literal_block, + nodes.table, + nodes.section, + captioned_literal_block, +) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index cd222f1c7..993f77e21 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -24,7 +24,6 @@ from six import itervalues, text_type from sphinx import addnodes from sphinx import highlighting -from sphinx.builders.latex.nodes import captioned_literal_block, footnotetext from sphinx.deprecation import RemovedInSphinx30Warning from sphinx.errors import SphinxError from sphinx.locale import admonitionlabels, _, __ @@ -57,13 +56,6 @@ SHORTHANDOFF = r''' MAX_CITATION_LABEL_LENGTH = 8 LATEXSECTIONNAMES = ["part", "chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"] -HYPERLINK_SUPPORT_NODES = ( - nodes.figure, - nodes.literal_block, - nodes.table, - nodes.section, - captioned_literal_block, -) ENUMERATE_LIST_STYLE = defaultdict(lambda: r'\arabic', { 'arabic': r'\arabic', @@ -2615,3 +2607,7 @@ class LaTeXTranslator(nodes.NodeVisitor): # # refs: https://github.com/sphinx-doc/sphinx/issues/4889 from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform # NOQA + +# 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