From af480796c9e447e63f2c3720543b8e1c148cf34b Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Sat, 2 Nov 2019 14:20:12 +0100 Subject: [PATCH 1/5] sage: ignore cmp deprecation in sagenb --- .../math/sage/patches/sagenb-cmp-deprecation.patch | 13 +++++++++++++ pkgs/applications/science/math/sage/sagenb.nix | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/applications/science/math/sage/patches/sagenb-cmp-deprecation.patch diff --git a/pkgs/applications/science/math/sage/patches/sagenb-cmp-deprecation.patch b/pkgs/applications/science/math/sage/patches/sagenb-cmp-deprecation.patch new file mode 100644 index 00000000000..9f502a66951 --- /dev/null +++ b/pkgs/applications/science/math/sage/patches/sagenb-cmp-deprecation.patch @@ -0,0 +1,13 @@ +diff --git a/sagenb/__init__.py b/sagenb/__init__.py +index 4db0d2cb..2fc5f01e 100644 +--- a/sagenb/__init__.py ++++ b/sagenb/__init__.py +@@ -1,3 +1,8 @@ + # -*- coding: utf-8 -* + # init ++import warnings + from . import storage ++ ++# deprecation in attrs, needs to be fixed in twisted ++warnings.filterwarnings('ignore', category=DeprecationWarning, ++ message=r'The usage of `cmp` is deprecated and will be removed.*') diff --git a/pkgs/applications/science/math/sage/sagenb.nix b/pkgs/applications/science/math/sage/sagenb.nix index 03b5b7a3bbf..77b2168ad97 100644 --- a/pkgs/applications/science/math/sage/sagenb.nix +++ b/pkgs/applications/science/math/sage/sagenb.nix @@ -26,6 +26,11 @@ buildPythonPackage rec { sha256 = "0bxvhr03qh2nsjdfc4pyfiqrn9jhp3vf7irsc9gqx0185jlblbxs"; }; + patches = [ + # cmp deprecation in attrs needs to be handled in twisted + ./patches/sagenb-cmp-deprecation.patch + ]; + propagatedBuildInputs = [ twisted flask From f85ce834ce426ab9abcd66a66d20afef5645baac Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Sat, 2 Nov 2019 15:15:17 +0100 Subject: [PATCH 2/5] sage: ignore deprecation warnings in rst2sws Needs to be fixed upstream (by werkzeug, twisted). Doesn't impact the functionality and the tests are soon to be removed with the py3 update anyway. --- .../sage/patches/ignore-cmp-deprecation.patch | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch b/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch index 5c1073e13e9..11ca7481961 100644 --- a/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch +++ b/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch @@ -1,13 +1,24 @@ diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py -index bd6b76ab82..f8340a8c66 100644 +index bd6b76ab82..ccf1203dec 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py -@@ -872,7 +872,7 @@ def test_executable(args, input="", timeout=100.0, **kwds): +@@ -837,8 +837,6 @@ def test_executable(args, input="", timeout=100.0, **kwds): + /// + 4 + }}} +- sage: err # py2 +- '' + sage: ret + 0 + +@@ -871,8 +869,8 @@ def test_executable(args, input="", timeout=100.0, **kwds): + sage: output = tmp_filename(ext='.sws') sage: with open(input, 'w') as F: ....: _ = F.write(s) - sage: test_executable(["sage", "--rst2sws", input, output]) # py2 +- sage: test_executable(["sage", "--rst2sws", input, output]) # py2 - ('', '', 0) -+ ('', '...', 0) ++ sage: test_executable(["sage", "--rst2sws", input, output])[2] # py2 ++ 0 sage: import tarfile # py2 sage: f = tarfile.open(output, 'r') # py2 sage: print(f.extractfile('sage_worksheet/worksheet.html').read()) # py2 From da7ec1c1397fd50803962e0bcf74e1fe97a228d5 Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Mon, 4 Nov 2019 21:48:38 +0100 Subject: [PATCH 3/5] sage: ignore werkzeug immutable dict deprecation --- .../ignore-werkzeug-immutable-dict-deprecation.patch | 12 ++++++++++++ pkgs/applications/science/math/sage/sage-src.nix | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/applications/science/math/sage/patches/ignore-werkzeug-immutable-dict-deprecation.patch diff --git a/pkgs/applications/science/math/sage/patches/ignore-werkzeug-immutable-dict-deprecation.patch b/pkgs/applications/science/math/sage/patches/ignore-werkzeug-immutable-dict-deprecation.patch new file mode 100644 index 00000000000..c5f95b498d5 --- /dev/null +++ b/pkgs/applications/science/math/sage/patches/ignore-werkzeug-immutable-dict-deprecation.patch @@ -0,0 +1,12 @@ +diff --git a/src/sage/all.py b/src/sage/all.py +index c87c9372e9..862fca4fcc 100644 +--- a/src/sage/all.py ++++ b/src/sage/all.py +@@ -306,6 +306,7 @@ warnings.filters.remove(('ignore', None, DeprecationWarning, None, 0)) + # Ignore all deprecations from IPython etc. + warnings.filterwarnings('ignore', category=DeprecationWarning, + module='.*(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic)') ++warnings.filterwarnings('ignore', category=DeprecationWarning, message=r".*The import 'werkzeug.ImmutableDict' is deprecated") + # Ignore collections.abc warnings, there are a lot of them but they are + # harmless. + warnings.filterwarnings('ignore', category=DeprecationWarning, diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix index c7a3da68b15..14b1023f26a 100644 --- a/pkgs/applications/science/math/sage/sage-src.nix +++ b/pkgs/applications/science/math/sage/sage-src.nix @@ -107,6 +107,10 @@ stdenv.mkDerivation rec { # ignore a deprecation warning for usage of `cmp` in the attrs library in the doctests ./patches/ignore-cmp-deprecation.patch + + # Werkzeug has deprecated ImmutableDict, but it is still used in legacy + # sagenb. That's no big issue since sagenb will be removed soon anyways. + ./patches/ignore-werkzeug-immutable-dict-deprecation.patch ]; patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches; From f64885b9ca7d3cb048027184f6094f81e7812e28 Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Mon, 4 Nov 2019 11:36:48 +0100 Subject: [PATCH 4/5] sage: fix pkgconfig errors in tests python.pkgs.pkgconfig raises an exception on missing packages since version 1.5.0. Previously those errors were just silently ignored. That worked fine, since the packages are only missing at runtime (when they are not really needed) but present at buildtime. Since this fails the tests now, we just add the packages to PKG_CONFIG_PATH at runtime. This does not add additional runtime dependencies. Still, it would be nicer if the sage testssuite would not test the buildsystem at runtime in the first place. The breakage was originally caused by the pkgconfig update in 1efa71616fadd5c7f852173445b2db824534b99b. --- .../science/math/sage/sage-env.nix | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix index 0b67b3cff12..00397239876 100644 --- a/pkgs/applications/science/math/sage/sage-env.nix +++ b/pkgs/applications/science/math/sage/sage-env.nix @@ -18,6 +18,12 @@ , ecl , maxima-ecl , singular +, fflas-ffpack +, givaro +, gd +, libpng +, linbox +, m4ri , giac , palp , rWrapper @@ -101,14 +107,21 @@ writeTextFile rec { name = "sage-env"; destination = "/${name}"; text = '' - export PKG_CONFIG_PATH='${lib.concatStringsSep ":" (map (pkg: "${pkg}/lib/pkgconfig") [ - # This is only needed in the src/sage/misc/cython.py test and I'm not - # sure if there's really a usecase for it outside of the tests. However - # since singular and openblas are runtime dependencies anyways, it doesn't - # really hurt to include. + export PKG_CONFIG_PATH='${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [ + # This should only be needed during build. However, since the doctests + # also test the cython build (for example in src/sage/misc/cython.py), + # it is also needed for the testsuite to pass. We could fix the + # testsuite instead, but since all the packages are also runtime + # dependencies it doesn't really hurt to include them here. singular openblasCompat - ]) + fflas-ffpack givaro + gd + libpng zlib + gsl + linbox + m4ri + ] }' export SAGE_ROOT='${sagelib.src}' export SAGE_LOCAL='@sage-local@' From afb9887dbdaf97e1447c46bab158723332a633b7 Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Wed, 6 Nov 2019 00:38:28 +0100 Subject: [PATCH 5/5] sage: backport fix for threejs r109 --- pkgs/applications/science/math/sage/sage-src.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix index 14b1023f26a..dc8ba48e45e 100644 --- a/pkgs/applications/science/math/sage/sage-src.nix +++ b/pkgs/applications/science/math/sage/sage-src.nix @@ -111,6 +111,13 @@ stdenv.mkDerivation rec { # Werkzeug has deprecated ImmutableDict, but it is still used in legacy # sagenb. That's no big issue since sagenb will be removed soon anyways. ./patches/ignore-werkzeug-immutable-dict-deprecation.patch + + # threejs r109 (#28560) + (fetchpatch { + name = "threejs-r109.patch"; + url = "https://git.sagemath.org/sage.git/patch?id=fcc11d6effa39f375bc5f4ea5831fb7a2f2767da"; + sha256 = "0hnmc8ld3bblks0hcjvjjaydkgwdr1cs3dbl2ys4gfq964pjgqwc"; + }) ]; patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;