@@ -9,6 +9,20 @@
99# This is done because multiple derivations rely on these sources and they should
1010# all get the same sources with the same patches applied.
1111
12+let
13+ # Fetch a diff between `base` and `rev` on sage's git server.
14+ # Used to fetch trac tickets by setting the `base` to the last release and the
15+ # `rev` to the last commit of the ticket.
16+ fetchSageDiff = { base, name, rev, sha256, ...}@args: (
17+ fetchpatch ({
18+ inherit name sha256;
19+ url = "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}";
20+ # We don't care about sage's own build system (which builds all its dependencies).
21+ # Exclude build system changes to avoid conflicts.
22+ excludes = [ "build/*" ];
23+ } // builtins.removeAttrs args [ "rev" "base" "sha256" ])
24+ );
25+in
1226stdenv.mkDerivation rec {
1327 version = "9.2";
1428 pname = "sage-src";
@@ -40,17 +54,13 @@ stdenv.mkDerivation rec {
4054 # https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
4155 ./patches/sphinx-docbuild-subprocesses.patch
4256
43− # Sage's workaround to pretty print dicts (in
44− # src/sage/doctest/forker.py:init_sage) runs too late (after
45− # controller.load_environment(), which imports sage.all.*) to to
46− # affect sage.sandpiles.Sandpile{Config,Divisor}'s pretty printer.
47− # Due to the sandpiles module being lazily loaded, this only
48− # affects the first run (subsequent runs read from an import cache
49− # at ~/.sage/cache and are not affected), which is probably why
50− # other distributions don't hit this bug. This breaks two sandpile
51− # tests, so do the workaround a little bit earlier.
52− # https://trac.sagemath.org/ticket/31053
53− ./patches/register-pretty-printer-earlier.patch
57+ # Register sorted dict pprinter earlier (https://trac.sagemath.org/ticket/31053)
58+ (fetchSageDiff {
59+ base = "9.3.beta4";
60+ name = "register-pretty-printer-earlier.patch";
61+ rev = "d658230ce06ca19f4a3b3a4576297ee82f2d2151";
62+ sha256 = "sha256-9mPUV7K5PoLDH2vVaYaOfvDLDpmxU0Aj7m/eaXYotDs=";
63+ })
5464 ];
5565
5666 # Since sage unfortunately does not release bugfix releases, packagers must
@@ -63,14 +73,20 @@ stdenv.mkDerivation rec {
6373
6474 # fix intermittent errors in Sage 9.2's psage.py (this patch is
6575 # already included in Sage 9.3): https://trac.sagemath.org/ticket/30730
66− (fetchpatch {
76+ (fetchSageDiff {
77+ base = "9.2.rc2";
6778 name = "fix-psage-is-locked.patch";
68− url = "https://git.sagemath.org/sage.git/patch/?id=75df605f216ddc7b6ca719be942d666b241520e9";
79+ rev = "75df605f216ddc7b6ca719be942d666b241520e9";
6980 sha256 = "0g9pl1wbb3sgs26d3bvv70cpa77sfskylv4kd255y1794f1fgk4q";
7081 })
7182
7283 # fix intermittent errors in sagespawn.pyx: https://trac.sagemath.org/ticket/31052
73− ./patches/sagespawn-implicit-casting.patch
84+ (fetchSageDiff {
85+ base = "9.2";
86+ name = "sagespawn-implicit-casting.patch";
87+ rev = "2959ac792ebd6107fe87c9af1541083de5ba02d6";
88+ sha256 = "sha256-bWIpEGir9Kawak5CJegBMNcHm/CqhWmdru+emeSsvO0=";
89+ })
7490
7591 # disable pexpect interrupt test (see https://trac.sagemath.org/ticket/30945)
7692 ./patches/disable-pexpect-intermittent-failure.patch
@@ -82,20 +98,7 @@ stdenv.mkDerivation rec {
8298 # compatible with never dependency versions when possible. All these changes
8399 # should come from or be proposed to upstream. This list will probably never
84100 # be empty since dependencies update all the time.
85− packageUpgradePatches = let
86− # Fetch a diff between `base` and `rev` on sage's git server.
87− # Used to fetch trac tickets by setting the `base` to the last release and the
88− # `rev` to the last commit of the ticket.
89− fetchSageDiff = { base, rev, name ? "sage-diff-${base}-${rev}.patch", ...}@args: (
90− fetchpatch ({
91− inherit name;
92− url = "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}";
93− # We don't care about sage's own build system (which builds all its dependencies).
94− # Exclude build system changes to avoid conflicts.
95− excludes = [ "build/*" ];
96− } // builtins.removeAttrs args [ "rev" "base" ])
97− );
98− in [
101+ packageUpgradePatches = [
99102 # After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
100103 # now set the cache dir to be withing the .sage directory. This is not
101104 # strictly necessary, but keeps us from littering in the user's HOME.
@@ -105,7 +108,12 @@ stdenv.mkDerivation rec {
105108 ./patches/ignore-cmp-deprecation.patch
106109
107110 # adapt sage's Image class to pillow 8.0.1 (https://trac.sagemath.org/ticket/30971)
108− ./patches/pillow-update.patch
111+ (fetchSageDiff {
112+ base = "9.3.beta2";
113+ name = "pillow-8.0.1-update.patch";
114+ rev = "f05f2d0aac9c4b5abe68105cee2cc7f2c8461847";
115+ sha256 = "sha256-uY2UlgSd5hhOUUukB4Xc3Gjy0/e7p/qyq9jdvz10IOs=";
116+ })
109117
110118 # fix test output with sympy 1.7 (https://trac.sagemath.org/ticket/30985)
111119 ./patches/sympy-1.7-update.patch