Merge pull request #5024 from tk0miya/5022_import_roman

Fix #5022: latex: crashed with docutils package provided by Debian/Ubuntu
This commit is contained in:
Takeshi KOMIYA 2018-06-07 22:34:52 +09:00 committed by GitHub
commit 65cf7b2cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Bugs fixed
* sphinx.testing uses deprecated pytest API; ``Node.get_marker(name)`` * sphinx.testing uses deprecated pytest API; ``Node.get_marker(name)``
* #5016: ``character_level_inline_markup`` setting is not initialized for * #5016: ``character_level_inline_markup`` setting is not initialized for
combination of non reST source parsers (ex. recommonmark) and docutils-0.13 combination of non reST source parsers (ex. recommonmark) and docutils-0.13
* #5022: latex: crashed with docutils package provided by Debian/Ubuntu
Testing Testing
-------- --------

View File

@ -18,7 +18,6 @@ from collections import defaultdict
from os import path from os import path
from docutils import nodes, writers from docutils import nodes, writers
from docutils.utils.roman import toRoman
from docutils.writers.latex2e import Babel from docutils.writers.latex2e import Babel
from six import itervalues, text_type from six import itervalues, text_type
@ -32,6 +31,12 @@ from sphinx.util.nodes import clean_astext
from sphinx.util.template import LaTeXRenderer from sphinx.util.template import LaTeXRenderer
from sphinx.util.texescape import tex_escape_map, tex_replace_map from sphinx.util.texescape import tex_escape_map, tex_replace_map
try:
from docutils.utils.roman import toRoman
except ImportError:
# In Debain/Ubuntu, roman package is provided as roman, not as docutils.utils.roman
from roman import toRoman
if False: if False:
# For type annotation # For type annotation
from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA