eric6/UI/Previewers/PreviewerHTML.py

branch
maintenance
changeset 7684
11e18bf34097
parent 7560
343db73c4842
parent 7675
7d23e502fe85
child 7737
5371a22cf2aa
diff -r 27cfb65c7324 -r 11e18bf34097 eric6/UI/Previewers/PreviewerHTML.py
--- a/eric6/UI/Previewers/PreviewerHTML.py	Sat Aug 01 10:39:12 2020 +0200
+++ b/eric6/UI/Previewers/PreviewerHTML.py	Wed Sep 02 18:06:20 2020 +0200
@@ -580,10 +580,12 @@
                 """<p>Alternatively you may disable Sphinx usage"""
                 """ on the Editor, Filehandling configuration page.</p>""")
         
-        tempDir = tempfile.mkdtemp(prefix='eric-rest-')
+        srcTempDir = tempfile.mkdtemp(prefix="eric-rest-src-")
+        outTempDir = tempfile.mkdtemp(prefix="eric-rest-out-")
+        doctreeTempDir = tempfile.mkdtemp(prefix="eric-rest-doctree-")
         try:
             filename = 'sphinx_preview'
-            basePath = os.path.join(tempDir, filename)
+            basePath = os.path.join(srcTempDir, filename)
             fh = open(basePath + '.rst', 'w', encoding='utf-8')
             fh.write(text)
             fh.close()
@@ -595,17 +597,20 @@
                          'html_use_modindex': False,
                          'html_use_smartypants': True,
                          'master_doc': filename}
-            app = Sphinx(srcdir=tempDir, confdir=None, outdir=tempDir,
-                         doctreedir=tempDir, buildername='html',
+            app = Sphinx(srcdir=srcTempDir, confdir=None, outdir=outTempDir,
+                         doctreedir=doctreeTempDir, buildername='html',
                          confoverrides=overrides, status=None,
                          warning=io.StringIO())
             app.build(force_all=True, filenames=None)
 
+            basePath = os.path.join(outTempDir, filename)
             fh = open(basePath + '.html', 'r', encoding='utf-8')
             html = fh.read()
             fh.close()
         finally:
-            shutil.rmtree(tempDir)
+            shutil.rmtree(srcTempDir)
+            shutil.rmtree(outTempDir)
+            shutil.rmtree(doctreeTempDir)
         
         return html
     

eric ide

mercurial