summaryrefslogtreecommitdiff
path: root/sphinx/cmdline.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-09-09 13:36:35 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-09-21 10:48:52 +0900
commit7863468683030dc42fe638d0ed3ed78cfd4546c9 (patch)
tree98d7f8a1c533a560d59199221e09bad4fbfb3f8f /sphinx/cmdline.py
parentfb9dc3539ae0a09d29c03342ed94b275450486ff (diff)
downloadsphinx-git-7863468683030dc42fe638d0ed3ed78cfd4546c9.tar.gz
Fix #2687: Uninstall sphinx directives and roles after build
Diffstat (limited to 'sphinx/cmdline.py')
-rw-r--r--sphinx/cmdline.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py
index ef80ed5b3..83f6048de 100644
--- a/sphinx/cmdline.py
+++ b/sphinx/cmdline.py
@@ -23,6 +23,7 @@ from sphinx.errors import SphinxError
from sphinx.application import Sphinx
from sphinx.util import Tee, format_exception_cut_frames, save_traceback
from sphinx.util.console import red, nocolor, color_terminal
+from sphinx.util.docutils import docutils_namespace
from sphinx.util.osutil import abspath, fs_encoding
from sphinx.util.pycompat import terminal_safe
@@ -288,11 +289,12 @@ def main(argv):
app = None
try:
- app = Sphinx(srcdir, confdir, outdir, doctreedir, opts.builder,
- confoverrides, status, warning, opts.freshenv,
- opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
- app.build(opts.force_all, filenames)
- return app.statuscode
+ with docutils_namespace():
+ app = Sphinx(srcdir, confdir, outdir, doctreedir, opts.builder,
+ confoverrides, status, warning, opts.freshenv,
+ opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
+ app.build(opts.force_all, filenames)
+ return app.statuscode
except (Exception, KeyboardInterrupt) as exc:
handle_exception(app, opts, exc, error)
return 1