From 0aef6270cd9a238126568df3749ccd8765c3c7cf Mon Sep 17 00:00:00 2001 From: Mauricio Collares Date: Fri, 24 Dec 2021 11:05:37 -0300 Subject: sage: generate setup.cfg and requirements.txt for sagelib --- pkgs/applications/science/math/sage/sagelib.nix | 45 +++++++++++++++++++++++-- 1 file 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 = '' -- cgit 1.4.1