nixpkgs/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch

59 lines
2.3 KiB
Diff
Raw Normal View History

2019-04-18 20:54:25 +00:00
diff --git a/src/sage_setup/docbuild/__init__.py b/src/sage_setup/docbuild/__init__.py
2019-07-02 20:03:53 +00:00
index 73a078e619..059125c59f 100644
2019-04-18 20:54:25 +00:00
--- a/src/sage_setup/docbuild/__init__.py
+++ b/src/sage_setup/docbuild/__init__.py
2019-07-02 20:03:53 +00:00
@@ -86,27 +86,6 @@ def builder_helper(type):
2019-04-18 20:54:25 +00:00
"""
Returns a function which builds the documentation for
output type ``type``.
-
- TESTS:
-
- Check that :trac:`25161` has been resolved::
-
- sage: from sage_setup.docbuild import DocBuilder, setup_parser
- sage: DocBuilder._options = setup_parser().parse_args([])[0] # builder_helper needs _options to be set
-
- sage: import sage_setup.docbuild.sphinxbuild
- sage: def raiseBaseException():
- ....: raise BaseException("abort pool operation")
- sage: original_runsphinx, sage_setup.docbuild.sphinxbuild.runsphinx = sage_setup.docbuild.sphinxbuild.runsphinx, raiseBaseException
-
2019-07-02 20:03:53 +00:00
- sage: from sage_setup.docbuild import builder_helper, build_ref_doc
- sage: from sage_setup.docbuild import _build_many as build_many
2019-04-18 20:54:25 +00:00
- 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)
2019-07-02 20:03:53 +00:00
@@ -128,10 +107,9 @@ def builder_helper(type):
2019-04-18 20:54:25 +00:00
logger.debug(build_command)
# Run Sphinx with Sage's special logger
- sys.argv = ["sphinx-build"] + build_command.split()
- from .sphinxbuild import runsphinx
2020-11-30 13:09:26 +00:00
+ args = "python3 -um sage_setup.docbuild.sphinxbuild -N".split() + build_command.split()
2019-04-18 20:54:25 +00:00
try:
- runsphinx()
+ subprocess.check_call(args)
except Exception:
if ABORT_ON_ERROR:
raise
diff --git a/src/sage_setup/docbuild/sphinxbuild.py b/src/sage_setup/docbuild/sphinxbuild.py
2019-07-02 20:03:53 +00:00
index fe7eba43b2..463790965c 100644
2019-04-18 20:54:25 +00:00
--- a/src/sage_setup/docbuild/sphinxbuild.py
+++ b/src/sage_setup/docbuild/sphinxbuild.py
2019-07-02 20:03:53 +00:00
@@ -321,3 +321,8 @@ def runsphinx():
2019-04-18 20:54:25 +00:00
sys.stderr = saved_stderr
sys.stdout.flush()
sys.stderr.flush()
+
+if __name__ == '__main__':
+ import sys
+ sys.argv[0] = "sphinx-build"
+ runsphinx()