git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #48788 from timokau/sage-docbuild

sage: fix docbuild

commitf6be71464786b45be67ff316f7a4e2152e018acd authorTimo Kaufmann <timokau@zoho.com> dateSun 21 Oct 2018, 19:35 (8 years ago) parent2b25e95b39142c
3 files changed+107
pkgs/applications/science/math/sage/patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch+26 pkgs/applications/science/math/sage/patches/revert-sphinx-always-fork.patch+71 pkgs/applications/science/math/sage/sage-src.nix+10
pkgs/applications/science/math/sage/patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patchnew file+26
@@ -0,0 +1,26 @@
1+From c8edfefbbec87ca776d3cf84ee895aac200dda40 Mon Sep 17 00:00:00 2001
2+From: Timo Kaufmann <timokau@zoho.com>
3+Date: Sun, 21 Oct 2018 17:52:40 +0200
4+Subject: [PATCH] Only test py2/py3 optional tests when all of sage is tested
5+
6+---
7+ src/sage/doctest/control.py | 3 ++-
8+ 1 file changed, 2 insertions(+), 1 deletion(-)
9+
10+diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
11+index bf18df8b2b..b04af0e2e8 100644
12+--- a/src/sage/doctest/control.py
13++++ b/src/sage/doctest/control.py
14+@@ -362,7 +362,8 @@ class DocTestController(SageObject):
15+ if not optionaltag_regex.search(o):
16+ raise ValueError('invalid optional tag {!r}'.format(o))
17+
18+- options.optional |= auto_optional_tags
19++ if "sage" in options.optional:
20++ options.optional |= auto_optional_tags
21+
22+ self.options = options
23+
24+--
25+2.18.1
26+
pkgs/applications/science/math/sage/patches/revert-sphinx-always-fork.patchnew file+71
@@ -0,0 +1,71 @@
1+commit f1c59929c3c180ac283334c2b3c901ac8c82f6b1
2+Author: Timo Kaufmann <timokau@zoho.com>
3+Date: Sat Oct 20 20:07:41 2018 +0200
4+
5+ Revert "Something related to the sphinxbuild seems to be leaking memory"
6+
7+ This reverts commit 7d85dc796c58c3de57401bc22d3587b94e205091.
8+
9+diff --git a/src/sage_setup/docbuild/__init__.py b/src/sage_setup/docbuild/__init__.py
10+index 0b24b1a60b..084c3f89d7 100644
11+--- a/src/sage_setup/docbuild/__init__.py
12++++ b/src/sage_setup/docbuild/__init__.py
13+@@ -265,29 +265,35 @@ class DocBuilder(object):
14+ # import the customized builder for object.inv files
15+ inventory = builder_helper('inventory')
16+
17+-def build_many(target, args):
18+- # Pool() uses an actual fork() to run each new instance. This is important
19+- # for performance reasons, i.e., don't use a forkserver when it becomes
20+- # available with Python 3: Here, sage is already initialized which is quite
21+- # costly, with a forkserver we would have to reinitialize it for every
22+- # document we build. At the same time, don't serialize this by taking the
23+- # pool (and thus the call to fork()) out completely: The call to Sphinx
24+- # leaks memory, so we need to build each document in its own process to
25+- # control the RAM usage.
26+- from multiprocessing import Pool
27+- pool = Pool(NUM_THREADS, maxtasksperchild=1)
28+- # map_async handles KeyboardInterrupt correctly. Plain map and
29+- # apply_async does not, so don't use it.
30+- x = pool.map_async(target, args, 1)
31+- try:
32+- ret = x.get(99999)
33+- pool.close()
34+- pool.join()
35+- except Exception:
36+- pool.terminate()
37+- if ABORT_ON_ERROR:
38+- raise
39+- return ret
40++if NUM_THREADS > 1:
41++ def build_many(target, args):
42++ from multiprocessing import Pool
43++ pool = Pool(NUM_THREADS, maxtasksperchild=1)
44++ # map_async handles KeyboardInterrupt correctly. Plain map and
45++ # apply_async does not, so don't use it.
46++ x = pool.map_async(target, args, 1)
47++ try:
48++ ret = x.get(99999)
49++ pool.close()
50++ pool.join()
51++ except Exception:
52++ pool.terminate()
53++ if ABORT_ON_ERROR:
54++ raise
55++ return ret
56++else:
57++ def build_many(target, args):
58++ results = []
59++
60++ for arg in args:
61++ try:
62++ results.append(target(arg))
63++ except Exception:
64++ if ABORT_ON_ERROR:
65++ raise
66++
67++ return results
68++
69+
70+ ##########################################
71+ # Parallel Building Ref Manual #
pkgs/applications/science/math/sage/sage-src.nix+10
@@ -27,6 +27,16 @@ stdenv.mkDerivation rec {
2727 # https://trac.sagemath.org/ticket/25316
2828 # https://github.com/python/cpython/pull/7476
2929 ./patches/python-5755-hotpatch.patch
30+
31+ # Revert the commit that made the sphinx build fork even in the single thread
32+ # case. For some yet unknown reason, that breaks the docbuild on nix and archlinux.
33+ # See https://groups.google.com/forum/#!msg/sage-packaging/VU4h8IWGFLA/mrmCMocYBwAJ.
34+ ./patches/revert-sphinx-always-fork.patch
35+
36+ # Make sure py2/py3 tests are only run when their expected context (all "sage"
37+ # tests) are also run. That is necessary to test dochtml individually. See
38+ # https://trac.sagemath.org/ticket/26110 for an upstream discussion.
39+ ./patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch
3040 ];
3141
3242 packageUpgradePatches = [