diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-04-18 17:22:03 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-04-18 17:22:03 +0300 |
commit | f1b387bdcff9fb74dad832865a32cc6b1f4a9b68 (patch) | |
tree | eecdbb4351552e1822aa772a7b96a9a6d9dde72b /sphinx/theming.py | |
parent | 13acfd3ce10e62584ebad27b3b4d022afa9fac25 (diff) |
Fix fail to load template file if the parent template is archived
Diffstat (limited to 'sphinx/theming.py')
-rw-r--r-- | sphinx/theming.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/theming.py b/sphinx/theming.py index f10d29010..a069a4e2c 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -22,6 +22,7 @@ from six.moves import configparser from sphinx import package_dir from sphinx.errors import ThemeError from sphinx.util import logging +from sphinx.util.osutil import ensuredir logger = logging.getLogger(__name__) @@ -127,12 +128,15 @@ class Theme(object): tdir, tinfo = self.themes[name] if tinfo is None: # already a directory, do nothing + self.rootdir = None self.themedir = tdir self.themedir_created = False else: # extract the theme to a temp directory - self.themedir = tempfile.mkdtemp('sxt') + self.rootdir = tempfile.mkdtemp('sxt') + self.themedir = path.join(self.rootdir, name) self.themedir_created = True + ensuredir(self.themedir) for name in tinfo.namelist(): if name.endswith('/'): continue @@ -214,7 +218,7 @@ class Theme(object): """Remove temporary directories.""" if self.themedir_created: try: - shutil.rmtree(self.themedir) + shutil.rmtree(self.rootdir) except Exception: pass if self.base: |