mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #2289 from Xarthisius/race_fix
Use ensuredir() for creating directories within BuildEnvironment.read_doc
This commit is contained in:
commit
eba0e314b3
@ -40,7 +40,7 @@ from sphinx import addnodes
|
||||
from sphinx.util import url_re, get_matching_docs, docname_join, split_into, \
|
||||
FilenameUniqDict, get_figtype, import_object, split_index_msg
|
||||
from sphinx.util.nodes import clean_astext, make_refnode, WarningStream, is_translatable
|
||||
from sphinx.util.osutil import SEP, getcwd, fs_encoding
|
||||
from sphinx.util.osutil import SEP, getcwd, fs_encoding, ensuredir
|
||||
from sphinx.util.i18n import find_catalog_files
|
||||
from sphinx.util.console import bold, purple
|
||||
from sphinx.util.matching import compile_matchers
|
||||
@ -855,9 +855,7 @@ class BuildEnvironment:
|
||||
# save the parsed doctree
|
||||
doctree_filename = self.doc2path(docname, self.doctreedir,
|
||||
'.doctree')
|
||||
dirname = path.dirname(doctree_filename)
|
||||
if not path.isdir(dirname):
|
||||
os.makedirs(dirname)
|
||||
ensuredir(path.dirname(doctree_filename))
|
||||
f = open(doctree_filename, 'wb')
|
||||
try:
|
||||
pickle.dump(doctree, f, pickle.HIGHEST_PROTOCOL)
|
||||
|
Loading…
Reference in New Issue
Block a user