Fix #5022: latex: crashed with docutils package provided by Debian/Ubuntu

This commit is contained in:
Takeshi KOMIYA 2018-05-31 12:39:17 +09:00
parent f88767c0ad
commit 49ab23db0b
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)``
* #5016: ``character_level_inline_markup`` setting is not initialized for
combination of non reST source parsers (ex. recommonmark) and docutils-0.13
* #5022: latex: crashed with docutils package provided by Debian/Ubuntu
Testing
--------

View File

@ -18,7 +18,6 @@ from collections import defaultdict
from os import path
from docutils import nodes, writers
from docutils.utils.roman import toRoman
from docutils.writers.latex2e import Babel
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.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:
# For type annotation
from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA