summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch
blob: 2bfac780dfca34c079f175c6d227acd9bb1790f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py
index c5be38600a..e1d15f62d3 100644
--- a/src/sage_docbuild/builders.py
+++ b/src/sage_docbuild/builders.py
@@ -105,31 +105,6 @@ def builder_helper(type):
     """
     Return a function which builds the documentation for
     output type ``type``.
-
-    TESTS:
-
-    Check that :trac:`25161` has been resolved::
-
-        sage: from sage_docbuild.builders import DocBuilder
-        sage: from sage_docbuild.__main__ import setup_parser
-        sage: DocBuilder._options = setup_parser().parse_args([]) # 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.misc.temporary_file import tmp_dir
-        sage: os.environ['SAGE_DOC'] = tmp_dir()
-        sage: sage.env.var('SAGE_DOC') # random
-        sage: from sage_docbuild.builders import builder_helper, build_ref_doc
-        sage: from sage_docbuild.builders import _build_many as build_many
-        sage: helper = builder_helper("html")
-        sage: try:  # optional - sagemath_doc_html
-        ....:     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)
@@ -157,10 +132,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 build_options.ABORT_ON_ERROR:
                 raise
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
index 07c584de55..b83283a9ee 100644
--- a/src/sage_docbuild/sphinxbuild.py
+++ b/src/sage_docbuild/sphinxbuild.py
@@ -331,3 +331,8 @@ def runsphinx():
         sys.stderr = saved_stderr
         sys.stdout.flush()
         sys.stderr.flush()
+
+if __name__ == '__main__':
+    import sys
+    sys.argv[0] = "sphinx-build"
+    runsphinx()