about summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/sage-src.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math/sage/sage-src.nix')
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix113
1 files changed, 18 insertions, 95 deletions
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 96b1adb562f49..4149e9163a363 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -1,6 +1,7 @@
 { stdenv
 , fetchFromGitHub
 , fetchpatch
+, fetchurl
 }:
 
 # This file is responsible for fetching the sage source and adding necessary patches.
@@ -9,14 +10,23 @@
 # all get the same sources with the same patches applied.
 
 stdenv.mkDerivation rec {
-  version = "10.0";
+  version = "10.2";
   pname = "sage-src";
 
   src = fetchFromGitHub {
     owner = "sagemath";
     repo = "sage";
     rev = version;
-    sha256 = "sha256-zN/Lo/GBCjYGemuaYpgG3laufN8te3wPjXMQ+Me9zgY=";
+    sha256 = "sha256-VXnPdJhtw5Y/anecrVpevJDCyBVfnjksyuuZslNipm4=";
+  };
+
+  # contains essential files (e.g., setup.cfg) generated by the bootstrap script.
+  # TODO: investigate https://github.com/sagemath/sage/pull/35950
+  configure-src = fetchurl {
+    # the hash below is the tagged commit's _parent_. it can also be found by looking for
+    # the "configure" asset at https://github.com/sagemath/sage/releases/tag/${version}
+    url = "mirror://sageupstream/configure/configure-b2813506039143e6f0abe859ab67a343abf72c2e.tar.gz";
+    sha256 = "sha256-a1v0XyoKI+zO6Sjm8DzEwItRHbIgRDbpj4UfwVH+/hw=";
   };
 
   # Patches needed because of particularities of nix or the way this is packaged.
@@ -52,99 +62,6 @@ stdenv.mkDerivation rec {
   # should come from or be proposed to upstream. This list will probably never
   # be empty since dependencies update all the time.
   packageUpgradePatches = [
-    # https://github.com/sagemath/sage/pull/35584, landed in 10.1.beta1
-    (fetchpatch {
-      name = "networkx-3.1-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/be0aab74fd7e399e146988ef27260d2837baebae.diff";
-      sha256 = "sha256-xBGrylNaiF7CpfmX9/4lTioP2LSYKoRCkKlKSGZuv9U=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35612, landed in 10.1.beta1
-    (fetchpatch {
-      name = "linbox-1.7-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/35cbd2f2a2c4c355455d39b1424f05ea0aa4349b.diff";
-      sha256 = "sha256-/TpvIQZUqmbUuz6wvp3ni9oRir5LBA2FKDJcmnHI1r4=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35619, landed in 10.1.beta1
-    (fetchpatch {
-      name = "maxima-5.46.0-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/4ddf9328e7598284d4bc03cd2ed890f0be6b6399.diff";
-      sha256 = "sha256-f6YaZiLSj+E0LJMsMZHDt6vecWffSAuUHYVkegBEhno=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35635, landed in 10.1.beta1
-    (fetchpatch {
-      name = "sympy-1.12-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/1a73b3bbbfa0f4a297e05d49305070e1ed5ae598.diff";
-      sha256 = "sha256-k8Oam+EiRcfXC7qCdLacCx+7vpUAw2K1wsjKcQbeGb4=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35826, landed in 10.1.beta5
-    (fetchpatch {
-      name = "numpy-1.25.0-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/ecfe06b8f1fe729b07e885f0de55244467e5c137.diff";
-      sha256 = "sha256-G0xhl+LyNdDYPzRqSHK3fHaepcIzpuwmqRiussraDf0=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35826#issuecomment-1658569891
-    ./patches/numpy-1.25-deprecation.patch
-
-    # https://github.com/sagemath/sage/pull/35842, landed in 10.1.beta5
-    (fetchpatch {
-      name = "scipy-1.11-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/90ece168c3c61508baa36659b0027b7dd8b43add.diff";
-      sha256 = "sha256-Y5TmuJcUJR+veb2AuSVODGs+xkVV+pTM8fWTm4q+NDs=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35825, landed in 10.1.beta6
-    (fetchpatch {
-      name = "singular-4.3.2p2-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/1a1b49f814cdf4c4c8d0ac8930610f3fef6af5b0.diff";
-      sha256 = "sha256-GqMgoi0tsP7zcCcPumhdsbvhPB6fgw1ufx6gHlc6iSc=";
-    })
-
-    # https://github.com/sagemath/sage/pull/36006, landed in 10.2.beta2
-    (fetchpatch {
-      name = "gmp-6.3-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/5e841de46c3baa99cd1145b36ff9163e9340a55c.diff";
-      sha256 = "sha256-fJPDryLtGBQz9qHDiCkBwjiW2lN6v7HiHgxY7CTeHcs=";
-    })
-
-    # https://github.com/sagemath/sage/pull/36279, landed in 10.2.beta4
-    (fetchpatch {
-       name = "matplotlib-3.8-upgrade.patch";
-       url = "https://github.com/sagemath/sage/commit/0fcf88935908440930c5f79202155aca4ad57518.diff";
-       sha256 = "sha256-mvqAHaTCXsxPv901L8HSTnrfghfXYdq0wfLoP/cYQZI=";
-    })
-
-    # https://github.com/sagemath/sage/pull/35658, landed in 10.1.beta2
-    (fetchpatch {
-      name = "sphinx-7-upgrade.patch";
-      url = "https://github.com/sagemath/sage/commit/cacd9a89b5c4fdcf84a8dd2b7d5bdc10cc78109a.diff";
-      sha256 = "sha256-qJvliTJjR3XBc5pH6Q0jtm8c4bhtZcTcF3O04Ro1uaU=";
-    })
-
-    # https://github.com/sagemath/sage/pull/36296, landed in 10.2.beta4
-    (fetchpatch {
-      name = "duplicate-args-region_plot.patch";
-      url = "https://github.com/sagemath/sage/commit/461727b453712550a2c5dc0ae11933523255aaed.diff";
-      sha256 = "sha256-mC8084VQoUBk4hocALF+Y9Cwb38Zt360eldi/SSjna8=";
-    })
-
-    # https://github.com/sagemath/sage/pull/36218, landed in 10.2.beta3
-    (fetchpatch {
-      name = "sageenv-disable-file-validation.patch";
-      url = "https://github.com/sagemath/sage/commit/31a764f4a9ec54d3ea970aa9514a088c4e603ebd.diff";
-      sha256 = "sha256-NhYUTTmYlyjss3eS8HZXP8U11TElQY0cv6KW4wBOaJY=";
-    })
-
-    # https://github.com/sagemath/sage/pull/36235, landed in 10.2.beta3
-    (fetchpatch {
-      name = "ecl-23.9.9.patch";
-      url = "https://github.com/sagemath/sage/commit/b6b50a80e9660c002d069019f5b8f04e9324a423.diff";
-      sha256 = "sha256-nF+5oKad1VYms6Dxr1t9/V0XBkoMfhy0KCY/ZPddrm0=";
-    })
   ];
 
   patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
@@ -158,11 +75,17 @@ stdenv.mkDerivation rec {
     sed -i \
       "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
       src/sage/env.py
+
+    # sage --docbuild unsets JUPYTER_PATH, which breaks our docbuilding
+    # https://trac.sagemath.org/ticket/33650#comment:32
+    sed -i "/export JUPYTER_PATH/d" src/bin/sage
   '';
 
   buildPhase = "# do nothing";
 
   installPhase = ''
     cp -r . "$out"
+    tar xkzf ${configure-src} -C "$out"
+    rm "$out/configure"
   '';
 }