git.iko.soy/typeable/nixpkgs
on master help sign in
sage: 8.6 -> 8.7

https://groups.google.com/forum/#!topic/sage-release/3m8PV9JkFro

commit49b8efcb841fd8f4896f1ac83e7ee672e82a18cf authorTimo Kaufmann <timokau@zoho.com> dateSun 27 Jan 2019, 11:28 (8 years ago) parent930fa9b
9 files changed+158−167
pkgs/applications/science/math/sage/env-locations.nix+1 pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch+95 pkgs/applications/science/math/sage/patches/do-not-test-package-manifests.patch+26 pkgs/applications/science/math/sage/patches/giac-1.5.0.patch−14 pkgs/applications/science/math/sage/patches/ignore-pip-deprecation.patch−22 pkgs/applications/science/math/sage/patches/revert-sphinx-always-fork.patch−71 pkgs/applications/science/math/sage/sage-src.nix+29−60 pkgs/applications/science/math/sage/sagedoc.nix+3 pkgs/applications/science/math/sage/sagelib.nix+4
pkgs/applications/science/math/sage/env-locations.nix+1
@@ -28,6 +28,7 @@ writeTextFile rec {
2828 export GPDOCDIR="${pari}/share/pari/doc"
2929 export SINGULARPATH='${singular}/share/singular'
3030 export SINGULAR_SO='${singular}/lib/libSingular.so'
31+ export GAP_SO='${gap}/lib/libgap.so'
3132 export SINGULAR_EXECUTABLE='${singular}/bin/Singular'
3233 export MAXIMA_FAS='${maxima-ecl}/lib/maxima/${maxima-ecl.version}/binary-ecl/maxima.fas'
3334 export MAXIMA_PREFIX="${maxima-ecl}"
pkgs/applications/science/math/sage/patches/do-not-test-find-library.patchnew file+95
@@ -0,0 +1,95 @@
1+diff --git a/src/sage/env.py b/src/sage/env.py
2+index 061b94f3f1..67cd091540 100644
3+--- a/src/sage/env.py
4++++ b/src/sage/env.py
5+@@ -189,88 +189,13 @@ var('MAXIMA_FAS')
6+ var('SAGE_BANNER', '')
7+ var('SAGE_IMPORTALL', 'yes')
8+
9+-
10+-def _get_shared_lib_filename(libname, *additional_libnames):
11+- """
12+- Return the full path to a shared library file installed in the standard
13+- location for the system within the ``LIBDIR`` prefix (or
14+- ``$SAGE_LOCAL/lib`` in the case of manual build of Sage).
15+-
16+- This can also be passed more than one library name (e.g. for cases where
17+- some library may have multiple names depending on the platform) in which
18+- case the first one found is returned.
19+-
20+- This supports most *NIX variants (in which ``lib<libname>.so`` is found
21+- under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
22+- extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
23+- or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
24+-
25+- For distributions like Debian that use a multiarch layout, we also try the
26+- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
27+-
28+- Returns ``None`` if the file does not exist.
29+-
30+- EXAMPLES::
31+-
32+- sage: import sys
33+- sage: from fnmatch import fnmatch
34+- sage: from sage.env import _get_shared_lib_filename
35+- sage: lib_filename = _get_shared_lib_filename("Singular",
36+- ....: "singular-Singular")
37+- sage: if sys.platform == 'cygwin':
38+- ....: pattern = "*/cygSingular-*.dll"
39+- ....: elif sys.platform == 'darwin':
40+- ....: pattern = "*/libSingular.dylib"
41+- ....: else:
42+- ....: pattern = "*/lib*Singular.so"
43+- sage: fnmatch(lib_filename, pattern)
44+- True
45+- sage: _get_shared_lib_filename("an_absurd_lib") is None
46+- True
47+- """
48+-
49+- for libname in (libname,) + additional_libnames:
50+- if sys.platform == 'cygwin':
51+- bindir = sysconfig.get_config_var('BINDIR')
52+- pats = ['cyg{}.dll'.format(libname), 'cyg{}-*.dll'.format(libname)]
53+- filenames = []
54+- for pat in pats:
55+- filenames += glob.glob(os.path.join(bindir, pat))
56+-
57+- # Note: This is not very robust, since if there are multi DLL
58+- # versions for the same library this just selects one more or less
59+- # at arbitrary. However, practically speaking, on Cygwin, there
60+- # will only ever be one version
61+- if filenames:
62+- return filenames[-1]
63+- else:
64+- if sys.platform == 'darwin':
65+- ext = 'dylib'
66+- else:
67+- ext = 'so'
68+-
69+- libdirs = [sysconfig.get_config_var('LIBDIR')]
70+- multilib = sysconfig.get_config_var('MULTILIB')
71+- if multilib:
72+- libdirs.insert(0, os.path.join(libdirs[0], multilib))
73+-
74+- for libdir in libdirs:
75+- basename = 'lib{}.{}'.format(libname, ext)
76+- filename = os.path.join(libdir, basename)
77+- if os.path.exists(filename):
78+- return filename
79+-
80+- # Just return None if no files were found
81+- return None
82+-
83+-
84+ # locate singular shared object
85+ # On Debian it's libsingular-Singular so try that as well
86+-SINGULAR_SO = _get_shared_lib_filename('Singular', 'singular-Singular')
87++SINGULAR_SO = '/default'
88+ var('SINGULAR_SO', SINGULAR_SO)
89+
90+ # locate libgap shared object
91+-GAP_SO= _get_shared_lib_filename('gap','')
92++GAP_SO= '/default'
93+ var('GAP_SO', GAP_SO)
94+
95+ # post process
pkgs/applications/science/math/sage/patches/do-not-test-package-manifests.patchnew file+26
@@ -0,0 +1,26 @@
1+diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
2+index 3bca15d53b..7cf04ff8d1 100644
3+--- a/src/sage/misc/package.py
4++++ b/src/sage/misc/package.py
5+@@ -478,16 +478,16 @@ def package_manifest(package):
6+
7+ EXAMPLES::
8+
9+- sage: from sage.misc.package import package_manifest
10+- sage: sagetex_manifest = package_manifest('sagetex')
11+- sage: sagetex_manifest['package_name'] == 'sagetex'
12++ sage: from sage.misc.package import package_manifest # optional - buildsystem
13++ sage: sagetex_manifest = package_manifest('sagetex') # optional - buildsystem
14++ sage: sagetex_manifest['package_name'] == 'sagetex' # optional - buildsystem
15+ True
16+- sage: 'files' in sagetex_manifest
17++ sage: 'files' in sagetex_manifest # optional - buildsystem
18+ True
19+
20+ Test a nonexistent package::
21+
22+- sage: package_manifest('dummy-package')
23++ sage: package_manifest('dummy-package') # optional - buildsystem
24+ Traceback (most recent call last):
25+ ...
26+ KeyError: 'dummy-package'
pkgs/applications/science/math/sage/patches/giac-1.5.0.patchdeleted−14
@@ -1,14 +0,0 @@
1−--- a/src/sage/interfaces/giac.py 2018-12-08 22:11:56.285500644 +0100
2−+++ b/src/sage/interfaces/giac.py 2018-12-08 22:11:56.285500644 +0100
3−@@ -617,10 +617,7 @@
4− '4\n3'
5− sage: s='g(x):={\nx+1;\nx+2;\n}'
6− sage: giac(s)
7−- (x)->{
8−- x+1;
9−- x+2;
10−- }
11−+ (x)->[x+1,x+2]
12− sage: giac.g(5)
13− 7
14− """
pkgs/applications/science/math/sage/patches/ignore-pip-deprecation.patchdeleted−22
@@ -1,22 +0,0 @@
1−diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
2−index 689e5a23b9..4e16fe3a8d 100644
3−--- a/src/sage/misc/package.py
4−+++ b/src/sage/misc/package.py
5−@@ -142,9 +142,14 @@ def pip_installed_packages():
6− sage: d['beautifulsoup'] # optional - beautifulsoup
7− u'...'
8− """
9−- proc = subprocess.Popen(["pip", "list", "--no-index", "--format", "json"], stdout=subprocess.PIPE)
10−- stdout = proc.communicate()[0].decode()
11−- return {package['name'].lower():package['version'] for package in json.loads(stdout)}
12−+ with open(os.devnull, 'w') as devnull:
13−+ proc = subprocess.Popen(
14−+ ["pip", "list", "--no-index", "--format", "json"],
15−+ stdout=subprocess.PIPE,
16−+ stderr=devnull,
17−+ )
18−+ stdout = proc.communicate()[0].decode()
19−+ return {package['name'].lower():package['version'] for package in json.loads(stdout)}
20−
21− def list_packages(*pkg_types, **opts):
22− r"""
pkgs/applications/science/math/sage/patches/revert-sphinx-always-fork.patchdeleted−71
@@ -1,71 +0,0 @@
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+29−60
@@ -10,14 +10,14 @@
1010# all get the same sources with the same patches applied.
1111
1212stdenv.mkDerivation rec {
13− version = "8.6";
14− name = "sage-src-${version}";
13+ version = "8.7";
14+ pname = "sage-src";
1515
1616 src = fetchFromGitHub {
1717 owner = "sagemath";
1818 repo = "sage";
1919 rev = version;
20− sha256 = "1vs3pbgbqpg0qnwr018bqsdmm7crgjp310cx8zwh7za3mv1cw5j3";
20+ sha256 = "05vvrd6syh0hlmrk6kzjrwd0hpmvxp8vr8p3mkjb0jh5p2kjdd27";
2121 };
2222
2323 # Patches needed because of particularities of nix or the way this is packaged.
@@ -37,12 +37,6 @@ stdenv.mkDerivation rec {
3737 # https://github.com/python/cpython/pull/7476
3838 ./patches/python-5755-hotpatch.patch
3939
40− # Revert the commit that made the sphinx build fork even in the single thread
41− # case. For some yet unknown reason, that breaks the docbuild on nix and archlinux.
42− # See https://groups.google.com/forum/#!msg/sage-packaging/VU4h8IWGFLA/mrmCMocYBwAJ.
43− # https://trac.sagemath.org/ticket/26608
44− ./patches/revert-sphinx-always-fork.patch
45−
4640 # Make sure py2/py3 tests are only run when their expected context (all "sage"
4741 # tests) are also run. That is necessary to test dochtml individually. See
4842 # https://trac.sagemath.org/ticket/26110 for an upstream discussion.
@@ -59,6 +53,21 @@ stdenv.mkDerivation rec {
5953 sha256 = "07p9i0fwjgapmfvmi436yn6v60p8pvmxqjc93wsssqgh5kd8qw3n";
6054 stripLen = 1;
6155 })
56+
57+ # Part of the build system. Should become unnecessary with sage 8.8.
58+ # Upstream discussion here: https://trac.sagemath.org/ticket/27124#comment:33
59+ ./patches/do-not-test-package-manifests.patch
60+
61+ # Not necessary since library location is set explicitly
62+ # https://trac.sagemath.org/ticket/27660#ticket
63+ ./patches/do-not-test-find-library.patch
64+
65+ # https://trac.sagemath.org/ticket/27697#ticket
66+ (fetchpatch {
67+ name = "pplpy-doc-location-configurable.patch";
68+ url = "https://git.sagemath.org/sage.git/patch/?h=c4d966e7cb0c7b87c55d52dc6f46518433a2a0a2";
69+ sha256 = "0pqbbsx8mriwny422s9mp3z5d095cnam32sm62q4mxk8g8jb9vm9";
70+ })
6271 ];
6372
6473 # Since sage unfortunately does not release bugfix releases, packagers must
@@ -72,12 +81,6 @@ stdenv.mkDerivation rec {
7281 url = "https://git.sagemath.org/sage.git/patch?id2=10407524b18659e14e184114b61c043fb816f3c2&id=c9b0cc9d0b8748ab85e568f8f57f316c5e8cbe54";
7382 sha256 = "0wgp7yvn9sm1ynlhcr4l0hzmvr2n28llg4xc01p6k1zz4im64c17";
7483 })
75− # https://trac.sagemath.org/ticket/27224
76− (fetchpatch {
77− name = "sig_on_in_matrix_misc.patch";
78− url = "https://git.sagemath.org/sage.git/patch?id=85d25bf2eb73f7d3c6de4ee6222b0c399be43b07";
79− sha256 = "1ciwhh57pnb9b4i8m3vb07wfsibsay5sg0jp5giq1pzc5zc79a4p";
80− })
8184 ];
8285
8386 # Patches needed because of package updates. We could just pin the versions of
@@ -110,52 +113,12 @@ stdenv.mkDerivation rec {
110113 stripLen = 1;
111114 })
112115
113− # https://trac.sagemath.org/ticket/26315
114− ./patches/giac-1.5.0.patch
115−
116− # https://trac.sagemath.org/ticket/26442
117− (fetchSageDiff {
118− name = "cypari2-2.0.3.patch";
119− base = "8.6.rc1";
120− rev = "cd62d45bcef93fb4f7ed62609a46135e6de07051";
121− sha256 = "08l2b9w0rn1zrha6188j72f7737xs126gkgmydjd31baa6367np2";
122− })
123−
124− # https://trac.sagemath.org/ticket/26949
125− (fetchpatch {
126− name = "sphinx-1.8.3-dependency.patch";
127− url = "https://git.sagemath.org/sage.git/patch?id=d305eda0fedc73fdbe0447b5d6d2b520b8d112c4";
128− sha256 = "1x3q5j8lq35vlj893gj5gq9fhzs60szm9r9rx6ri79yiy9apabph";
129− })
130116 # https://trac.sagemath.org/ticket/26451
131− (fetchpatch {
132− name = "sphinx-1.8.3.patch";
133− url = "https://git.sagemath.org/sage.git/patch?id2=0cb494282d7b4cea50aba7f4d100e7932a4c00b1&id=62b989d5ee1d9646db85ea56053cd22e9ffde5ab";
134− sha256 = "1n5c61mvhalcr2wbp66wzsynwwk59aakvx3xqa5zw9nlkx3rd0h1";
135− })
136−
137− # https://trac.sagemath.org/ticket/27061
138− (fetchpatch {
139− name = "numpy-1.16-inline-fortran.patch";
140− url = "https://git.sagemath.org/sage.git/patch?id=a05b6b038e1571ab15464e98f76d1927c0c3fd12";
141− sha256 = "05yq97pq84xi60wb1p9skrad5h5x770gq98ll4frr7hvvmlwsf58";
142− })
143−
144− # https://trac.sagemath.org/ticket/27405
145− ./patches/ignore-pip-deprecation.patch
146−
147− # https://trac.sagemath.org/ticket/27360
148− (fetchpatch {
149− name = "eclib-20190226.patch";
150− url = "https://git.sagemath.org/sage.git/patch/?id=f570e3a7fc2965764b84c04ce301a88ded2c42df";
151− sha256 = "0l5c4giixkn15v2a06sfzq5mkxila6l67zkjbacirwprrlpcnmmp";
152− })
153−
154− # https://trac.sagemath.org/ticket/27420
155− (fetchpatch {
156− name = "cypari-2.1.patch";
157− url = "https://git.sagemath.org/sage.git/patch/?id=e351bf2f2914e683d5e2028597c45ae8d1b7f855";
158− sha256 = "00faa7fl0vaqcqbw0bidkhl78qa8l34d3a07zirbcl0vm74bdn1p";
117+ (fetchSageDiff {
118+ name = "sphinx-1.8.patch";
119+ base = "8.7";
120+ rev = "737afd8f314bd1e16feaec562bb4b5efa2effa8b";
121+ sha256 = "0n56ss88ds662bp49j23z5c2i6hsn3jynxw13wv76hyl0h7l1hjh";
159122 })
160123
161124 # https://trac.sagemath.org/ticket/27653
@@ -177,6 +140,12 @@ stdenv.mkDerivation rec {
177140 echo '#!${runtimeShell}
178141 python "$@"' > build/bin/sage-python23
179142
143+ # Make sure sage can at least be imported without setting any environment
144+ # variables. It won't be close to feature complete though.
145+ sed -i \
146+ "s|var('SAGE_LOCAL',.*|var('SAGE_LOCAL', '$out/src')|" \
147+ src/sage/env.py
148+
180149 # Do not use sage-env-config (generated by ./configure).
181150 # Instead variables are set manually.
182151 echo '# do nothing' > src/bin/sage-env-config
pkgs/applications/science/math/sage/sagedoc.nix+3
@@ -52,6 +52,9 @@ stdenv.mkDerivation rec {
5252 export HOME="$TMPDIR/sage_home"
5353 mkdir -p "$HOME"
5454
55+ # needed to link them in the sage docs using intersphinx
56+ export PPLPY_DOCS=${python.pkgs.pplpy.doc}/share/doc/pplpy
57+
5558 ${sage-with-env}/bin/sage -python -m sage_setup.docbuild \
5659 --mathjax \
5760 --no-pdf-links \
pkgs/applications/science/math/sage/sagelib.nix+4
@@ -47,6 +47,8 @@
4747, jupyter_core
4848, libhomfly
4949, libbraiding
50+, gmpy2
51+, pplpy
5052}:
5153
5254# This is the core sage python package. Everything else is just wrappers gluing
@@ -115,6 +117,8 @@ buildPythonPackage rec {
115117 cysignals
116118 libhomfly
117119 libbraiding
120+ gmpy2
121+ pplpy
118122 ];
119123
120124 buildPhase = ''