summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math/sage')
-rw-r--r--pkgs/applications/science/math/sage/default.nix39
-rw-r--r--pkgs/applications/science/math/sage/patches/eclib-20180710.patch40
-rw-r--r--pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch14
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix16
-rw-r--r--pkgs/applications/science/math/sage/sagenb.nix8
5 files changed, 84 insertions, 33 deletions
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
index 9ad112213ffd..1f540cc2b287 100644
--- a/pkgs/applications/science/math/sage/default.nix
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -14,16 +14,6 @@ let
 
       cvxopt = super.cvxopt.override { inherit glpk; };
 
-      # https://github.com/sagemath/sagenb/issues/437
-      flask-babel = super.flask-babel.overridePythonAttrs (attrs: rec {
-        version = "0.9";
-        src = attrs.src.override {
-          inherit version;
-          sha256 = "0k7vk4k54y55ma0nx2k5s0phfqbriwslhy5shh3b0d046q7ibzaa";
-        };
-        doCheck = false;
-      });
-
       # python packages that appear unmaintained and were not accepted into the nixpkgs
       # tree because of that. These packages are only dependencies of the more-or-less
       # deprecated sagenb. However sagenb is still a default dependency and the doctests
@@ -36,7 +26,7 @@ let
       pybrial = self.callPackage ./pybrial.nix {};
 
       sagelib = self.callPackage ./sagelib.nix {
-        inherit flint ecl pari glpk eclib;
+        inherit flint ecl pari glpk eclib ntl arb;
         inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
         linbox = nixpkgs.linbox.override { withSage = true; };
       };
@@ -57,13 +47,13 @@ let
       };
 
       sage-env = self.callPackage ./sage-env.nix {
-        inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv;
+        inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv giac ntl;
         pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
       };
 
       sage-with-env = self.callPackage ./sage-with-env.nix {
-        inherit pari eclib pythonEnv;
-        inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
+        inherit pari eclib pythonEnv ntl;
+        inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular giac;
         pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
         three = nodePackages_8_x.three;
       };
@@ -118,10 +108,23 @@ let
     });
   };
 
+  # https://trac.sagemath.org/ticket/25532
+  ntl = nixpkgs.ntl.overrideAttrs (oldAttrs: rec {
+    name = "ntl-10.5.0";
+    sourceRoot = "${name}/src";
+    src = fetchurl {
+      url = "http://www.shoup.net/ntl/${name}.tar.gz";
+      sha256 = "1lmldaldgfr2b2a6585m3np5ds8bq1bis2s1ajycjm49vp4kc2xr";
+    };
+  });
+
+  giac = nixpkgs.giac.override { inherit ntl; };
+  arb = nixpkgs.arb.override { inherit flint; };
+
   # update causes issues
   # https://groups.google.com/forum/#!topic/sage-packaging/cS3v05Q0zso
   # https://trac.sagemath.org/ticket/24735
-  singular = nixpkgs.singular.overrideAttrs (oldAttrs: {
+  singular = (nixpkgs.singular.override { inherit ntl flint; }).overrideAttrs (oldAttrs: {
     name = "singular-4.1.0p3";
     src = fetchurl {
       url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-1-0/singular-4.1.0p3.tar.gz";
@@ -131,15 +134,15 @@ let
 
   # *not* to confuse with the python package "pynac"
   # https://trac.sagemath.org/ticket/24838 (depends on arb update)
-  pynac = nixpkgs.pynac.override { inherit singular; };
+  pynac = nixpkgs.pynac.override { inherit singular flint; };
 
-  eclib = nixpkgs.eclib.override { inherit pari; };
+  eclib = nixpkgs.eclib.override { inherit pari ntl; };
 
   # With openblas (64 bit), the tests fail the same way as when sage is build with
   # openblas instead of openblasCompat. Apparently other packages somehow use flints
   # blas when it is available. Alternative would be to override flint to use
   # openblasCompat.
-  flint = nixpkgs.flint.override { withBlas = false; };
+  flint = nixpkgs.flint.override { withBlas = false; inherit ntl; };
 
   # Multiple palp dimensions need to be available and sage expects them all to be
   # in the same folder.
diff --git a/pkgs/applications/science/math/sage/patches/eclib-20180710.patch b/pkgs/applications/science/math/sage/patches/eclib-20180710.patch
new file mode 100644
index 000000000000..d06e1e6cedf2
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/eclib-20180710.patch
@@ -0,0 +1,40 @@
+diff --git a/src/sage/interfaces/mwrank.py b/src/sage/interfaces/mwrank.py
+index 4417b59276..ae57ca2991 100644
+--- a/src/sage/interfaces/mwrank.py
++++ b/src/sage/interfaces/mwrank.py
+@@ -54,8 +54,9 @@ def Mwrank(options="", server=None, server_tmpdir=None):
+         sage: M = Mwrank('-v 0 -l')
+         sage: print(M('0 0 1 -1 0'))
+         Curve [0,0,1,-1,0] :    Rank = 1
+-        Generator 1 is [0:-1:1]; height 0.0511114082399688
+-        Regulator = 0.0511114082399688
++        Generator 1 is [0:-1:1]; height 0.051111408239969
++        Regulator = 0.051111408239969
++
+     """
+     global instances
+     try:
+diff --git a/src/sage/libs/eclib/wrap.cpp b/src/sage/libs/eclib/wrap.cpp
+index 5fd5693b53..d12468faa8 100644
+--- a/src/sage/libs/eclib/wrap.cpp
++++ b/src/sage/libs/eclib/wrap.cpp
+@@ -133,8 +133,8 @@ char* Curvedata_isogeny_class(struct Curvedata* E, int verbose)
+ 
+ 
+ int mw_process(struct Curvedata* curve, struct mw* m,
+-                      const struct bigint* x, const struct bigint* y,
+-                      const struct bigint* z, int sat)
++                      const bigint* x, const bigint* y,
++                      const bigint* z, int sat)
+ {
+   Point P(*curve, *x, *y, *z);
+   if (!P.isvalid())
+@@ -188,7 +188,7 @@ int mw_rank(struct mw* m)
+ }
+ 
+ /* Returns index and unsat long array, which user must deallocate */
+-int mw_saturate(struct mw* m, struct bigint* index, char** unsat,
++int mw_saturate(struct mw* m, bigint* index, char** unsat,
+                        long sat_bd, int odd_primes_only)
+ {
+   vector<long> v;
diff --git a/pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch b/pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch
deleted file mode 100644
index b57e48b86dec..000000000000
--- a/pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-reverted:
---- b/src/sage/geometry/polyhedron/backend_cdd.py
-+++ a/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -154,7 +154,9 @@
-             ...    [0.62, -1.38, 0.38],[0.144, -1.04, 0.04],
-             ...    [0.1309090909, -1.0290909091, 0.04]]
-             sage: Polyhedron(point_list)
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: *Error: Numerical inconsistency is found.  Use the GMP exact arithmetic.
--            A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 14 vertices
-             sage: Polyhedron(point_list, base_ring=QQ)
-             A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 14 vertices
-         """
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 2eb7f8100597..c97785c574cb 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -84,6 +84,12 @@ stdenv.mkDerivation rec {
   ];
 
   packageUpgradePatches = [
+    (fetchpatch {
+      name = "cypari2-1.2.1.patch";
+      url = "https://git.sagemath.org/sage.git/patch/?h=62fe6eb15111327d930336d4252d5b23cbb22ab9";
+      sha256 = "1xax7vvs8h4xip16xcsp47xdb6lig6f2r3pl8cksvlz8lhgbyxh2";
+    })
+
     # matplotlib 2.2.2 deprecated `normed` (replaced by `density`).
     # This patch only ignores the warning. It would be equally easy to fix it
     # (by replacing all mentions of `normed` by `density`), but its better to
@@ -150,7 +156,12 @@ stdenv.mkDerivation rec {
       sha256 = "0fmw7pzbaxs2dshky6iw9pr8i23p9ih2y2lw661qypdrxh5xw03k";
       stripLen = 1;
     })
-    ./patches/revert-269c1e1551285.patch
+    (fetchpatch {
+      name = "revert-cddlib-doctest-changes.patch";
+      url = "https://git.sagemath.org/sage.git/patch/?id=269c1e1551285566b8ba7a2b890989e5590e9f11";
+      sha256 = "12bcjhq7hm2pmmj2bgjvcffjyls2x7q61ivlnaj5v5bsvhc183iy";
+      revert = true;
+    })
 
 
     # Only formatting changes.
@@ -170,6 +181,9 @@ stdenv.mkDerivation rec {
 
     # https://trac.sagemath.org/ticket/24838 rebased
     ./patches/pynac-0.7.22.patch
+
+    # https://trac.sagemath.org/ticket/25862
+    ./patches/eclib-20180710.patch
   ];
 
   patches = nixPatches ++ packageUpgradePatches;
diff --git a/pkgs/applications/science/math/sage/sagenb.nix b/pkgs/applications/science/math/sage/sagenb.nix
index 5ab387ebc5e1..cc883cc24b42 100644
--- a/pkgs/applications/science/math/sage/sagenb.nix
+++ b/pkgs/applications/science/math/sage/sagenb.nix
@@ -36,6 +36,14 @@ buildPythonPackage rec {
   # tests depend on sage
   doCheck = false;
 
+  patches = [
+    # work with latest flask-babel
+    (fetchpatch {
+      url = "https://github.com/sagemath/sagenb/commit/ba065eca63dd34a383e4c7ba7561430a90fcd087.patch";
+      sha256 = "1lamzsrgymdd618imrasjp6ivhw2aynh83gkybsd7pm1rzjcq4x8";
+    })
+  ];
+
   meta = with stdenv.lib; {
     description = "Sage Notebook";
     license = licenses.gpl3Plus;