2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
python,
|
|
|
|
fetchpatch,
|
|
|
|
fetchPypi,
|
|
|
|
pari,
|
|
|
|
gmp,
|
|
|
|
cython,
|
|
|
|
cysignals,
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# Reverse dependency
|
|
|
|
sage,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cypari2";
|
|
|
|
# upgrade may break sage, please test the sage build or ping @timokau on upgrade
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.1.5";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-GiWGXDTyCx3JWDB5jjSrZDbieLjgyA3HvwqzTF2wOrg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
# patch to avoid some segfaults in sage's totallyreal.pyx test.
|
2024-01-25 14:12:00 +00:00
|
|
|
# (https://trac.sagemath.org/ticket/27267).
|
2021-03-20 04:20:00 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "use-trashcan-for-gen.patch";
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "https://raw.githubusercontent.com/sagemath/sage/b6ea17ef8e4d652de0a85047bac8d41e90b25555/build/pkgs/cypari/patches/trashcan.patch";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-w4kktWb9/aR9z4CjrUvAMOxEwRN2WkubaKzQttN8rU8=";
|
2021-03-20 04:20:00 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
preBuild = ''
|
|
|
|
# generate cythonized extensions (auto_paridecl.pxd is crucial)
|
|
|
|
${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ pari ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ gmp ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
cysignals
|
2024-04-21 15:54:59 +00:00
|
|
|
cython
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkPhase = ''
|
2024-01-25 14:12:00 +00:00
|
|
|
test -f "$out/${python.sitePackages}/cypari2/auto_paridecl.pxd"
|
2020-04-24 23:36:52 +00:00
|
|
|
make check
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit sage;
|
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Cython bindings for PARI";
|
2021-03-20 04:20:00 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-11-21 19:51:51 +00:00
|
|
|
maintainers = teams.sage.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/defeo/cypari2";
|
|
|
|
};
|
|
|
|
}
|