sage: generate setup.cfg and requirements.txt for sagelib

This commit is contained in:
Mauricio Collares 2021-12-24 11:05:37 -03:00
parent 0a6b5115f6
commit 0aef6270cd

View File

@ -2,6 +2,7 @@
, env-locations , env-locations
, perl , perl
, buildPythonPackage , buildPythonPackage
, m4
, arb , arb
, blas , blas
, lapack , lapack
@ -54,6 +55,18 @@
, gmpy2 , gmpy2
, pplpy , pplpy
, sqlite , 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); assert (!blas.isILP64) && (!lapack.isILP64);
@ -75,6 +88,7 @@ buildPythonPackage rec {
pkg-config pkg-config
pip # needed to query installed packages pip # needed to query installed packages
lisp-compiler lisp-compiler
m4
]; ];
buildInputs = [ buildInputs = [
@ -130,6 +144,18 @@ buildPythonPackage rec {
gmpy2 gmpy2
pplpy pplpy
sqlite sqlite
mpmath
rpy2
scipy
sympy
matplotlib
pillow
ipykernel
fpylll
networkx
jupyter-client
ipywidgets
sphinx
]; ];
preBuild = '' preBuild = ''
@ -148,8 +174,23 @@ buildPythonPackage rec {
mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython" mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
mkdir -p "var/lib/sage/installed" 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
cd build/pkgs/sagelib/src
# 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 = '' postInstall = ''