about summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2019-09-23 17:11:15 +0200
committerTimo Kaufmann <timokau@zoho.com>2019-09-23 17:11:15 +0200
commit8593d468ae1dcea52af1f085db676b826c8c3d71 (patch)
treeb7de10af0d9946db4cd9604ced903a9e455eda69 /pkgs/applications/science/math/sage
parent84578046aad4168af3d7f738864c578c2cefba41 (diff)
parent94a84b844e650b06fd14c96d041e1b577bc31172 (diff)
downloadnixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.tar
nixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.tar.gz
nixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.tar.bz2
nixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.tar.lz
nixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.tar.xz
nixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.tar.zst
nixlib-8593d468ae1dcea52af1f085db676b826c8c3d71.zip
Merge remote-tracking branch 'upstream/master' into sage-8.9
Diffstat (limited to 'pkgs/applications/science/math/sage')
-rw-r--r--pkgs/applications/science/math/sage/dist-tests.nix17
-rw-r--r--pkgs/applications/science/math/sage/flask-oldsessions.nix2
-rw-r--r--pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch19
-rw-r--r--pkgs/applications/science/math/sage/patches/sympow-cache.patch21
-rw-r--r--pkgs/applications/science/math/sage/pybrial.nix2
-rw-r--r--pkgs/applications/science/math/sage/sage-env.nix2
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix11
-rw-r--r--pkgs/applications/science/math/sage/sage-tests.nix10
-rw-r--r--pkgs/applications/science/math/sage/sage-with-env.nix2
-rw-r--r--pkgs/applications/science/math/sage/sage.nix6
-rw-r--r--pkgs/applications/science/math/sage/sagedoc.nix2
-rw-r--r--pkgs/applications/science/math/sage/sagelib.nix2
12 files changed, 84 insertions, 12 deletions
diff --git a/pkgs/applications/science/math/sage/dist-tests.nix b/pkgs/applications/science/math/sage/dist-tests.nix
new file mode 100644
index 000000000000..24a86a8f37a4
--- /dev/null
+++ b/pkgs/applications/science/math/sage/dist-tests.nix
@@ -0,0 +1,17 @@
+# Lists past failures and files associated with it. The intention is to build
+# up a subset of a testsuite that catches 95% of failures that are relevant for
+# distributions while only taking ~5m to run. This in turn makes it more
+# reasonable to re-test sage on dependency changes and makes it easier for
+# users to override the sage derivation.
+# This is an experiment for now. If it turns out that there really is a small
+# subset of files responsible for the vast majority of packaging tests, we can
+# think about moving this upstream.
+[
+	"src/sage/env.py" # [1]
+	"src/sage/misc/persist.pyx" # [1]
+	"src/sage/misc/inline_fortran.py" # [1]
+	"src/sage/repl/ipython_extension.py" # [1]
+]
+
+# Numbered list of past failures to annotate files with
+# [1] PYTHONPATH related issue https://github.com/NixOS/nixpkgs/commit/ec7f569211091282410050e89e68832d4fe60528
diff --git a/pkgs/applications/science/math/sage/flask-oldsessions.nix b/pkgs/applications/science/math/sage/flask-oldsessions.nix
index 85e35736d030..0899c93602b9 100644
--- a/pkgs/applications/science/math/sage/flask-oldsessions.nix
+++ b/pkgs/applications/science/math/sage/flask-oldsessions.nix
@@ -13,7 +13,7 @@ buildPythonPackage rec {
   src = fetchFromGitHub {
     owner = "mitsuhiko";
     repo = "flask-oldsessions";
-    rev = "${version}";
+    rev = version;
     sha256 = "04b5m8njjiwld9a0zw55iqwvyjgwcpdbhz1cic8nyhgcmypbicqn";
   };
 
diff --git a/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch b/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch
new file mode 100644
index 000000000000..e687281ad1a7
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch
@@ -0,0 +1,19 @@
+diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py
+index 67d7d2accf..18279581e2 100644
+--- a/src/sage/repl/configuration.py
++++ b/src/sage/repl/configuration.py
+@@ -9,10 +9,11 @@ the IPython simple prompt is being used::
+     sage: cmd = 'print([sys.stdin.isatty(), sys.stdout.isatty()])'
+     sage: import pexpect
+     sage: output = pexpect.run(
+-    ....:     'bash -c \'echo "{0}" | sage\''.format(cmd),
++    ....:     'bash -c \'export SAGE_BANNER=no; echo "{0}" | sage\''.format(cmd),
+     ....: ).decode('utf-8', 'surrogateescape')
+-    sage: 'sage: [False, True]' in output
+-    True
++    sage: print(output)
++    sage...[False, True]
++    sage...Exiting Sage ...
+ """
+ 
+ #*****************************************************************************
diff --git a/pkgs/applications/science/math/sage/patches/sympow-cache.patch b/pkgs/applications/science/math/sage/patches/sympow-cache.patch
new file mode 100644
index 000000000000..20020d610f80
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/sympow-cache.patch
@@ -0,0 +1,21 @@
+diff --git a/src/sage/lfunctions/sympow.py b/src/sage/lfunctions/sympow.py
+index 1640ac4f6a..03578be7b8 100644
+--- a/src/sage/lfunctions/sympow.py
++++ b/src/sage/lfunctions/sympow.py
+@@ -50,6 +50,7 @@ from __future__ import print_function, absolute_import
+ 
+ import os
+ 
++from sage.env import DOT_SAGE
+ from sage.structure.sage_object import SageObject
+ from sage.misc.all import pager, verbose
+ import sage.rings.all
+@@ -76,7 +77,7 @@ class Sympow(SageObject):
+         """
+         Used to call sympow with given args
+         """
+-        cmd = 'sympow %s'%args
++        cmd = 'env SYMPOW_CACHEDIR="%s/sympow///" sympow %s' % (DOT_SAGE, args)
+         v = os.popen(cmd).read().strip()
+         verbose(v, level=2)
+         return v
diff --git a/pkgs/applications/science/math/sage/pybrial.nix b/pkgs/applications/science/math/sage/pybrial.nix
index f5cb39603c32..092a340bb5b5 100644
--- a/pkgs/applications/science/math/sage/pybrial.nix
+++ b/pkgs/applications/science/math/sage/pybrial.nix
@@ -15,7 +15,7 @@ buildPythonPackage rec {
     src = fetchFromGitHub {
       owner = "BRiAl";
       repo = "BRiAl";
-      rev = "${version}";
+      rev = version;
       sha256 = "0qy4cwy7qrk4zg151cmws5cglaa866z461cnj9wdnalabs7v7qbg";
     };
 
diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix
index 8fd69f62171a..0b67b3cff12b 100644
--- a/pkgs/applications/science/math/sage/sage-env.nix
+++ b/pkgs/applications/science/math/sage/sage-env.nix
@@ -44,6 +44,7 @@
 , gsl
 , ntl
 , jdk
+, less
 }:
 
 # This generates a `sage-env` shell file that will be sourced by sage on startup.
@@ -92,6 +93,7 @@ let
     rubiks
     flintqs
     jdk # only needed for `jmol` which may be replaced in the future
+    less # needed to prevent transient test errors until https://github.com/ipython/ipython/pull/11864 is resolved
   ]
   ));
 in
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index e4f38265c41c..09edd2addfab 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -57,7 +57,11 @@ stdenv.mkDerivation rec {
   # Since sage unfortunately does not release bugfix releases, packagers must
   # fix those bugs themselves. This is for critical bugfixes, where "critical"
   # == "causes (transient) doctest failures / somebody complained".
-  bugfixPatches = [ ];
+  bugfixPatches = [
+    # To help debug the transient error in
+    # https://trac.sagemath.org/ticket/23087 when it next occurs.
+    ./patches/configurationpy-error-verbose.patch
+  ];
 
   # Patches needed because of package updates. We could just pin the versions of
   # dependencies, but that would lead to rebuilds, confusion and the burdons of
@@ -88,6 +92,11 @@ stdenv.mkDerivation rec {
       sha256 = "0b9293v73wb4x13wv5zwyjgclc01zn16msccfzzi6znswklgvddp";
       stripLen = 1;
     })
+
+    # After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
+    # now set the cache dir to be withing the .sage directory. This is not
+    # strictly necessary, but keeps us from littering in the user's HOME.
+    ./patches/sympow-cache.patch
   ];
 
   patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
diff --git a/pkgs/applications/science/math/sage/sage-tests.nix b/pkgs/applications/science/math/sage/sage-tests.nix
index 12433e12fe90..93ec1e33cf69 100644
--- a/pkgs/applications/science/math/sage/sage-tests.nix
+++ b/pkgs/applications/science/math/sage/sage-tests.nix
@@ -23,9 +23,9 @@ let
   relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
   testFileList = lib.concatStringsSep " " (map relpathToArg files);
 in
-stdenv.mkDerivation rec {
+stdenv.mkDerivation {
   version = src.version;
-  name = "sage-tests-${version}";
+  pname = "sage-tests";
   inherit src;
 
   buildInputs = [
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     sage-with-env
   ];
 
-  unpackPhase = "#do nothing";
+  dontUnpack = true;
   configurePhase = "#do nothing";
   buildPhase = "#do nothing";
 
@@ -51,6 +51,10 @@ stdenv.mkDerivation rec {
     export HOME="$TMPDIR/sage-home"
     mkdir -p "$HOME"
 
+    # avoid running out of memory with many threads in subprocesses, see
+    # https://github.com/NixOS/nixpkgs/pull/65802
+    export GLIBC_TUNABLES=glibc.malloc.arena_max=4
+
     echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}"
     "sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs}
   '';
diff --git a/pkgs/applications/science/math/sage/sage-with-env.nix b/pkgs/applications/science/math/sage/sage-with-env.nix
index e4b1aeae016a..524085e8c012 100644
--- a/pkgs/applications/science/math/sage/sage-with-env.nix
+++ b/pkgs/applications/science/math/sage/sage-with-env.nix
@@ -87,7 +87,7 @@ let
 in
 stdenv.mkDerivation rec {
   version = src.version;
-  name = "sage-with-env-${version}";
+  pname = "sage-with-env";
   src = sage-env.lib.src;
 
   inherit buildInputs;
diff --git a/pkgs/applications/science/math/sage/sage.nix b/pkgs/applications/science/math/sage/sage.nix
index 541b9cb36dc2..4fa8ae6270ba 100644
--- a/pkgs/applications/science/math/sage/sage.nix
+++ b/pkgs/applications/science/math/sage/sage.nix
@@ -11,7 +11,7 @@
 # A wrapper that makes sure sage finds its docs (if they were build) and the
 # jupyter kernel spec.
 
-let 
+let
   # generate kernel spec + default kernels
   kernel-specs = jupyter-kernel.create {
     definitions = jupyter-kernel.default // {
@@ -21,7 +21,7 @@ let
 in
 stdenv.mkDerivation rec {
   version = src.version;
-  name = "sage-${version}";
+  pname = "sage";
   src = sage-with-env.env.lib.src;
 
   buildInputs = [
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     sage-tests
   ];
 
-  unpackPhase = "#do nothing";
+  dontUnpack = true;
   configurePhase = "#do nothing";
   buildPhase = "#do nothing";
 
diff --git a/pkgs/applications/science/math/sage/sagedoc.nix b/pkgs/applications/science/math/sage/sagedoc.nix
index 91c880673a12..bf618fe64f45 100644
--- a/pkgs/applications/science/math/sage/sagedoc.nix
+++ b/pkgs/applications/science/math/sage/sagedoc.nix
@@ -9,7 +9,7 @@
 
 stdenv.mkDerivation rec {
   version = src.version;
-  name = "sagedoc-${version}";
+  pname = "sagedoc";
   src = sage-with-env.env.lib.src;
 
 
diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix
index bf0ab30c7e4c..69f7624078ea 100644
--- a/pkgs/applications/science/math/sage/sagelib.nix
+++ b/pkgs/applications/science/math/sage/sagelib.nix
@@ -60,7 +60,7 @@
 buildPythonPackage rec {
   format = "other";
   version = src.version;
-  name = "sagelib-${version}";
+  pname = "sagelib";
   src = sage-src;
 
   nativeBuildInputs = [