depot/third_party/nixpkgs/pkgs/development/python-modules/cypari2/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

68 lines
1.7 KiB
Nix

{ lib
, buildPythonPackage
, python
, fetchpatch
, fetchPypi
, pari
, gmp
, cython
, cysignals
}:
buildPythonPackage rec {
pname = "cypari2";
# upgrade may break sage, please test the sage build or ping @timokau on upgrade
version = "2.1.3";
format = "setuptools";
src = fetchPypi {
inherit pname version;
sha256 = "17beb467d3cb39fffec3227c468f0dd8db8a09129faeb95a6bb4c84b2b6c6683";
};
patches = [
# patch to avoid some segfaults in sage's totallyreal.pyx test.
# (https://trac.sagemath.org/ticket/27267). depends on Cython patch.
(fetchpatch {
name = "use-trashcan-for-gen.patch";
url = "https://raw.githubusercontent.com/sagemath/sage/b6ea17ef8e4d652de0a85047bac8d41e90b25555/build/pkgs/cypari/patches/trashcan.patch";
hash = "sha256-w4kktWb9/aR9z4CjrUvAMOxEwRN2WkubaKzQttN8rU8=";
})
];
# This differs slightly from the default python installPhase in that it pip-installs
# "." instead of "*.whl".
# That is because while the default install phase succeeds to build the package,
# it fails to generate the file "auto_paridecl.pxd".
installPhase = ''
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
# install "." instead of "*.whl"
pip install . --no-index --no-warn-script-location --prefix="$out" --no-cache
'';
nativeBuildInputs = [
pari
python.pythonOnBuildForHost.pkgs.pip
];
buildInputs = [
gmp
];
propagatedBuildInputs = [
cysignals
cython
];
checkPhase = ''
make check
'';
meta = with lib; {
description = "Cython bindings for PARI";
license = licenses.gpl2Plus;
maintainers = teams.sage.members;
homepage = "https://github.com/defeo/cypari2";
};
}