##// END OF EJS Templates
Merge pull request #7316 from yarikoptic/enh/emb_sphinx_shell_cleanup...
Thomas Kluyver -
r19734:911aaedd merge
parent child Browse files
Show More
@@ -126,12 +126,14 b' from __future__ import print_function'
126 126 #-----------------------------------------------------------------------------
127 127
128 128 # Stdlib
129 import atexit
129 130 import os
130 131 import re
131 132 import sys
132 133 import tempfile
133 134 import ast
134 135 import warnings
136 import shutil
135 137
136 138 # To keep compatibility with various python versions
137 139 try:
@@ -295,6 +297,7 b' class EmbeddedSphinxShell(object):'
295 297 # Create and initialize global ipython, but don't start its mainloop.
296 298 # This will persist across different EmbededSphinxShell instances.
297 299 IP = InteractiveShell.instance(config=config, profile_dir=profile)
300 atexit.register(self.cleanup)
298 301
299 302 # io.stdout redirect must be done after instantiating InteractiveShell
300 303 io.stdout = self.cout
@@ -312,6 +315,7 b' class EmbeddedSphinxShell(object):'
312 315
313 316 self.input = ''
314 317 self.output = ''
318 self.tmp_profile_dir = tmp_profile_dir
315 319
316 320 self.is_verbatim = False
317 321 self.is_doctest = False
@@ -332,6 +336,9 b' class EmbeddedSphinxShell(object):'
332 336 for line in exec_lines:
333 337 self.process_input_line(line, store_history=False)
334 338
339 def cleanup(self):
340 shutil.rmtree(self.tmp_profile_dir, ignore_errors=True)
341
335 342 def clear_cout(self):
336 343 self.cout.seek(0)
337 344 self.cout.truncate(0)
General Comments 0
You need to be logged in to leave comments. Login now