From 1714747318b731a39e0c8104ac53611a47ae202e Mon Sep 17 00:00:00 2001 From: "Kacper Kowalik (Xarthisius)" Date: Tue, 2 Feb 2016 14:16:47 -0600 Subject: [PATCH] Use ensuredir() for creating directories within BuildEnvironment.read_doc --- sphinx/environment.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sphinx/environment.py b/sphinx/environment.py index 8d0789cfa..9e5a870a4 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -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)