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):
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)
def get_sphinx_rst_finish(self, result):
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