Commit e801ee70 authored by Christian Hergert's avatar Christian Hergert

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.
parent f9160551
...@@ -482,28 +482,31 @@ class HtmlPreviewPage(Ide.Page): ...@@ -482,28 +482,31 @@ class HtmlPreviewPage(Ide.Page):
def get_sphinx_rst_worker(self, task, text, path, basedir, builddir): def get_sphinx_rst_worker(self, task, text, path, basedir, builddir):
add_override_file(path, text) add_override_file(path, text)
if GLib.find_program_in_path('sphinx-build-3'):
program = 'sphinx-build-3'
program = 'sphinx-build'
rel_path = os.path.relpath(path, start=basedir) 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' rel_path_html = os.path.splitext(rel_path)[0] + '.html'
builddir_path = os.path.join(builddir, rel_path_html) builddir_path = os.path.join(builddir, rel_path_html)
try: try:
import launcher = # Gio.SubprocessFlags.STDOUT_SILENCE |
build_main = # Gio.SubprocessFlags.STDERR_SILENCE)
except: launcher.push_args(command)
build_main = sphinx.build_main subprocess = launcher.spawn()
result = not build_main(command)
remove_override_file(path) task.builddir_path = builddir_path
if not result: except Exception as ex:
task.builddir_path = None task.return_error(GLib.Error(ex))
task.return_error(GLib.Error('\'sphinx-build\' command error for {}'.format(path))) finally:
return remove_override_file(path)
task.builddir_path = builddir_path
def get_sphinx_rst_finish(self, result): def get_sphinx_rst_finish(self, result):
succes = result.propagate_boolean() succes = result.propagate_boolean()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment