summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/sagelib.nix
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2021-12-24 11:05:37 -0300
committerMauricio Collares <mauricio@collares.org>2022-01-24 20:54:53 -0300
commit0aef6270cd9a238126568df3749ccd8765c3c7cf (patch)
tree7160b6189474bf2bc320c034a9373c3f6df26ddf /pkgs/applications/science/math/sage/sagelib.nix
parent0a6b5115f69e010d157c6c365d71006eebc09d36 (diff)
downloadnixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.tar
nixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.tar.gz
nixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.tar.bz2
nixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.tar.lz
nixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.tar.xz
nixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.tar.zst
nixpkgs-0aef6270cd9a238126568df3749ccd8765c3c7cf.zip
sage: generate setup.cfg and requirements.txt for sagelib
Diffstat (limited to 'pkgs/applications/science/math/sage/sagelib.nix')
-rw-r--r--pkgs/applications/science/math/sage/sagelib.nix45
1 files changed, 43 insertions, 2 deletions
diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix
index a884ad8899d..47e857a7bbb 100644
--- a/pkgs/applications/science/math/sage/sagelib.nix
+++ b/pkgs/applications/science/math/sage/sagelib.nix
@@ -2,6 +2,7 @@
 , env-locations
 , perl
 , buildPythonPackage
+, m4
 , arb
 , blas
 , lapack
@@ -54,6 +55,18 @@
 , gmpy2
 , pplpy
 , sqlite
+, jupyter-client
+, ipywidgets
+, mpmath
+, rpy2
+, fpylll
+, scipy
+, sympy
+, matplotlib
+, pillow
+, ipykernel
+, networkx
+, sphinx # TODO: this is in setup.cfg, bug should we override it?
 }:
 
 assert (!blas.isILP64) && (!lapack.isILP64);
@@ -75,6 +88,7 @@ buildPythonPackage rec {
     pkg-config
     pip # needed to query installed packages
     lisp-compiler
+    m4
   ];
 
   buildInputs = [
@@ -130,6 +144,18 @@ buildPythonPackage rec {
     gmpy2
     pplpy
     sqlite
+    mpmath
+    rpy2
+    scipy
+    sympy
+    matplotlib
+    pillow
+    ipykernel
+    fpylll
+    networkx
+    jupyter-client
+    ipywidgets
+    sphinx
   ];
 
   preBuild = ''
@@ -148,8 +174,23 @@ buildPythonPackage rec {
     mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
     mkdir -p "var/lib/sage/installed"
 
-    # src/setup.py should not be used, see https://trac.sagemath.org/ticket/31377#comment:124
-    cd build/pkgs/sagelib/src
+    cd build/pkgs/sagelib
+
+    # some files, like Pipfile, pyproject.toml, requirements.txt and setup.cfg
+    # are generated by the bootstrap script using m4. these can fetch data from
+    # build/pkgs, either directly or via sage-get-system-packages.
+    sed -i 's/==2.1.0rc1/>=2.1.1/' ../gmpy2/install-requires.txt
+    sed -i 's/, <3.4//' ../rpy2/install-requires.txt
+    sed -i '/sage_conf/d' src/setup.cfg.m4
+    sed -i '/sage_conf/d' src/requirements.txt.m4
+    for infile in src/*.m4; do
+        if [ -f "$infile" ]; then
+            outfile="src/$(basename $infile .m4)"
+            m4 "$infile" > "$outfile"
+        fi
+    done
+
+    cd src
   '';
 
   postInstall = ''