090b71f627
Co-authored-by: Mauricio Collares <mauricio@collares.org>
59 lines
2.2 KiB
Diff
59 lines
2.2 KiB
Diff
diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py
|
|
index 79005b903a..fbe6fe2595 100644
|
|
--- a/src/sage_docbuild/__init__.py
|
|
+++ b/src/sage_docbuild/__init__.py
|
|
@@ -85,27 +85,6 @@ def builder_helper(type):
|
|
"""
|
|
Returns a function which builds the documentation for
|
|
output type ``type``.
|
|
-
|
|
- TESTS:
|
|
-
|
|
- Check that :trac:`25161` has been resolved::
|
|
-
|
|
- sage: from sage_docbuild import DocBuilder, setup_parser
|
|
- sage: DocBuilder._options = setup_parser().parse_args([])[0] # builder_helper needs _options to be set
|
|
-
|
|
- sage: import sage_docbuild.sphinxbuild
|
|
- sage: def raiseBaseException():
|
|
- ....: raise BaseException("abort pool operation")
|
|
- sage: original_runsphinx, sage_docbuild.sphinxbuild.runsphinx = sage_docbuild.sphinxbuild.runsphinx, raiseBaseException
|
|
-
|
|
- sage: from sage_docbuild import builder_helper, build_ref_doc
|
|
- sage: from sage_docbuild import _build_many as build_many
|
|
- sage: helper = builder_helper("html")
|
|
- sage: try:
|
|
- ....: build_many(build_ref_doc, [("docname", "en", "html", {})])
|
|
- ....: except Exception as E:
|
|
- ....: "Non-exception during docbuild: abort pool operation" in str(E)
|
|
- True
|
|
"""
|
|
def f(self, *args, **kwds):
|
|
output_dir = self._output_dir(type)
|
|
@@ -127,10 +106,9 @@ def builder_helper(type):
|
|
logger.debug(build_command)
|
|
|
|
# Run Sphinx with Sage's special logger
|
|
- sys.argv = ["sphinx-build"] + build_command.split()
|
|
- from .sphinxbuild import runsphinx
|
|
+ args = "python3 -um sage_docbuild.sphinxbuild -N".split() + build_command.split()
|
|
try:
|
|
- runsphinx()
|
|
+ subprocess.check_call(args)
|
|
except Exception:
|
|
if ABORT_ON_ERROR:
|
|
raise
|
|
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
|
|
index f58f6c61d7..ef51a55411 100644
|
|
--- a/src/sage_docbuild/sphinxbuild.py
|
|
+++ b/src/sage_docbuild/sphinxbuild.py
|
|
@@ -326,3 +326,8 @@ def runsphinx():
|
|
sys.stderr = saved_stderr
|
|
sys.stdout.flush()
|
|
sys.stderr.flush()
|
|
+
|
|
+if __name__ == '__main__':
|
|
+ import sys
|
|
+ sys.argv[0] = "sphinx-build"
|
|
+ runsphinx()
|