[gnome-builder] html-preview: run sphinx-build command manually
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] html-preview: run sphinx-build command manually
- Date: Wed, 4 Sep 2019 21:51:37 +0000 (UTC)
commit e801ee70e05bd558f77baa98fe61d061d6b44483
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 4 14:51:35 2019 -0700
html-preview: run sphinx-build command manually
Using the library to perform this work is not working correctly, so at
least for now (and the 3.34 release) we should just call the commands
directly using a subprocess launcher.
src/plugins/html-preview/html_preview.py | 33 +++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/html-preview/html_preview.py b/src/plugins/html-preview/html_preview.py
index 3207984e7..9d5806744 100644
--- a/src/plugins/html-preview/html_preview.py
+++ b/src/plugins/html-preview/html_preview.py
@@ -482,28 +482,31 @@ class HtmlPreviewPage(Ide.Page):
def get_sphinx_rst_worker(self, task, text, path, basedir, builddir):
add_override_file(path, text)
+ if GLib.find_program_in_path('sphinx-build-3'):
+ program = 'sphinx-build-3'
+ else:
+ program = 'sphinx-build'
+
rel_path = os.path.relpath(path, start=basedir)
- command = ['sphinx-build', '-Q', '-b', 'html', basedir, builddir, path]
+ command = [program, '-Q', '-b', 'html', basedir, builddir, path]
rel_path_html = os.path.splitext(rel_path)[0] + '.html'
builddir_path = os.path.join(builddir, rel_path_html)
try:
- import sphinx.cmd.build
- build_main = sphinx.cmd.build.main
- except:
- build_main = sphinx.build_main
-
- result = not build_main(command)
- remove_override_file(path)
-
- if not result:
- task.builddir_path = None
- task.return_error(GLib.Error('\'sphinx-build\' command error for {}'.format(path)))
- return
+ launcher = Ide.SubprocessLauncher.new(0) # Gio.SubprocessFlags.STDOUT_SILENCE |
+ # Gio.SubprocessFlags.STDERR_SILENCE)
+ launcher.push_args(command)
+ subprocess = launcher.spawn()
+ subprocess.wait_check()
+
+ task.builddir_path = builddir_path
+ task.return_boolean(True)
+ except Exception as ex:
+ task.return_error(GLib.Error(ex))
+ finally:
+ remove_override_file(path)
- task.builddir_path = builddir_path
- task.return_boolean(True)
def get_sphinx_rst_finish(self, result):
succes = result.propagate_boolean()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]