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

sage: fix tests

commitc54848ee77194b8ebc874a45534bc818fd19b89b authorTimo Kaufmann <timokau@zoho.com> dateWed 6 Nov 2019, 16:21 (7 years ago) parenteeba5c8afb9887
6 files changed+75−10
pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch+15−4 pkgs/applications/science/math/sage/patches/ignore-werkzeug-immutable-dict-deprecation.patch+12 pkgs/applications/science/math/sage/patches/sagenb-cmp-deprecation.patch+13 pkgs/applications/science/math/sage/sage-env.nix+19−6 pkgs/applications/science/math/sage/sage-src.nix+11 pkgs/applications/science/math/sage/sagenb.nix+5
pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch+15−4
@@ -1,13 +1,24 @@
11diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py
2−index bd6b76ab82..f8340a8c66 100644
2+index bd6b76ab82..ccf1203dec 100644
33--- a/src/sage/tests/cmdline.py
44+++ b/src/sage/tests/cmdline.py
5−@@ -872,7 +872,7 @@ def test_executable(args, input="", timeout=100.0, **kwds):
5+@@ -837,8 +837,6 @@ def test_executable(args, input="", timeout=100.0, **kwds):
6+ ///
7+ 4
8+ }}}
9+- sage: err # py2
10+- ''
11+ sage: ret
12+ 0
13+
14+@@ -871,8 +869,8 @@ def test_executable(args, input="", timeout=100.0, **kwds):
15+ sage: output = tmp_filename(ext='.sws')
616 sage: with open(input, 'w') as F:
717 ....: _ = F.write(s)
8− sage: test_executable(["sage", "--rst2sws", input, output]) # py2
18+- sage: test_executable(["sage", "--rst2sws", input, output]) # py2
919- ('', '', 0)
10−+ ('', '...', 0)
20++ sage: test_executable(["sage", "--rst2sws", input, output])[2] # py2
21++ 0
1122 sage: import tarfile # py2
1223 sage: f = tarfile.open(output, 'r') # py2
1324 sage: print(f.extractfile('sage_worksheet/worksheet.html').read()) # py2
pkgs/applications/science/math/sage/patches/ignore-werkzeug-immutable-dict-deprecation.patchnew file+12
@@ -0,0 +1,12 @@
1+diff --git a/src/sage/all.py b/src/sage/all.py
2+index c87c9372e9..862fca4fcc 100644
3+--- a/src/sage/all.py
4++++ b/src/sage/all.py
5+@@ -306,6 +306,7 @@ warnings.filters.remove(('ignore', None, DeprecationWarning, None, 0))
6+ # Ignore all deprecations from IPython etc.
7+ warnings.filterwarnings('ignore', category=DeprecationWarning,
8+ module='.*(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic)')
9++warnings.filterwarnings('ignore', category=DeprecationWarning, message=r".*The import 'werkzeug.ImmutableDict' is deprecated")
10+ # Ignore collections.abc warnings, there are a lot of them but they are
11+ # harmless.
12+ warnings.filterwarnings('ignore', category=DeprecationWarning,
pkgs/applications/science/math/sage/patches/sagenb-cmp-deprecation.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/sagenb/__init__.py b/sagenb/__init__.py
2+index 4db0d2cb..2fc5f01e 100644
3+--- a/sagenb/__init__.py
4++++ b/sagenb/__init__.py
5+@@ -1,3 +1,8 @@
6+ # -*- coding: utf-8 -*
7+ # init
8++import warnings
9+ from . import storage
10++
11++# deprecation in attrs, needs to be fixed in twisted
12++warnings.filterwarnings('ignore', category=DeprecationWarning,
13++ message=r'The usage of `cmp` is deprecated and will be removed.*')
pkgs/applications/science/math/sage/sage-env.nix+19−6
@@ -18,6 +18,12 @@
1818, ecl
1919, maxima-ecl
2020, singular
21+, fflas-ffpack
22+, givaro
23+, gd
24+, libpng
25+, linbox
26+, m4ri
2127, giac
2228, palp
2329, rWrapper
@@ -101,14 +107,21 @@ writeTextFile rec {
101107 name = "sage-env";
102108 destination = "/${name}";
103109 text = ''
104− export PKG_CONFIG_PATH='${lib.concatStringsSep ":" (map (pkg: "${pkg}/lib/pkgconfig") [
105− # This is only needed in the src/sage/misc/cython.py test and I'm not
106− # sure if there's really a usecase for it outside of the tests. However
107− # since singular and openblas are runtime dependencies anyways, it doesn't
108− # really hurt to include.
110+ export PKG_CONFIG_PATH='${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
111+ # This should only be needed during build. However, since the doctests
112+ # also test the cython build (for example in src/sage/misc/cython.py),
113+ # it is also needed for the testsuite to pass. We could fix the
114+ # testsuite instead, but since all the packages are also runtime
115+ # dependencies it doesn't really hurt to include them here.
109116 singular
110117 openblasCompat
111− ])
118+ fflas-ffpack givaro
119+ gd
120+ libpng zlib
121+ gsl
122+ linbox
123+ m4ri
124+ ]
112125 }'
113126 export SAGE_ROOT='${sagelib.src}'
114127 export SAGE_LOCAL='@sage-local@'
pkgs/applications/science/math/sage/sage-src.nix+11
@@ -107,6 +107,17 @@ stdenv.mkDerivation rec {
107107
108108 # ignore a deprecation warning for usage of `cmp` in the attrs library in the doctests
109109 ./patches/ignore-cmp-deprecation.patch
110+
111+ # Werkzeug has deprecated ImmutableDict, but it is still used in legacy
112+ # sagenb. That's no big issue since sagenb will be removed soon anyways.
113+ ./patches/ignore-werkzeug-immutable-dict-deprecation.patch
114+
115+ # threejs r109 (#28560)
116+ (fetchpatch {
117+ name = "threejs-r109.patch";
118+ url = "https://git.sagemath.org/sage.git/patch?id=fcc11d6effa39f375bc5f4ea5831fb7a2f2767da";
119+ sha256 = "0hnmc8ld3bblks0hcjvjjaydkgwdr1cs3dbl2ys4gfq964pjgqwc";
120+ })
110121 ];
111122
112123 patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
pkgs/applications/science/math/sage/sagenb.nix+5
@@ -26,6 +26,11 @@ buildPythonPackage rec {
2626 sha256 = "0bxvhr03qh2nsjdfc4pyfiqrn9jhp3vf7irsc9gqx0185jlblbxs";
2727 };
2828
29+ patches = [
30+ # cmp deprecation in attrs needs to be handled in twisted
31+ ./patches/sagenb-cmp-deprecation.patch
32+ ];
33+
2934 propagatedBuildInputs = [
3035 twisted
3136 flask