1{ lib
2, buildPythonPackage
3, python
4, fetchpatch
5, fetchPypi
6, pari
7, gmp
8, cython
9, cysignals
10}:
11
12buildPythonPackage rec {
13 pname = "cypari2";
14 # upgrade may break sage, please test the sage build or ping @timokau on upgrade
15 version = "2.1.3";
16
17 src = fetchPypi {
18 inherit pname version;
19 sha256 = "17beb467d3cb39fffec3227c468f0dd8db8a09129faeb95a6bb4c84b2b6c6683";
20 };
21
22 patches = [
23 # patch to avoid some segfaults in sage's totallyreal.pyx test.
24 # (https://trac.sagemath.org/ticket/27267). depends on Cython patch.
25 (fetchpatch {
26 name = "use-trashcan-for-gen.patch";
27 url = "https://git.sagemath.org/sage.git/plain/build/pkgs/cypari/patches/trashcan.patch?id=b6ea17ef8e4d652de0a85047bac8d41e90b25555";
28 sha256 = "sha256-w4kktWb9/aR9z4CjrUvAMOxEwRN2WkubaKzQttN8rU8=";
29 })
30 ];
31
32 # This differs slightly from the default python installPhase in that it pip-installs
33 # "." instead of "*.whl".
34 # That is because while the default install phase succeeds to build the package,
35 # it fails to generate the file "auto_paridecl.pxd".
36 installPhase = ''
37 export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
38
39 # install "." instead of "*.whl"
40 ${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install . --no-index --no-warn-script-location --prefix="$out" --no-cache
41 '';
42
43 nativeBuildInputs = [
44 pari
45 ];
46
47 buildInputs = [
48 gmp
49 ];
50
51 propagatedBuildInputs = [
52 cysignals
53 cython
54 ];
55
56 checkPhase = ''
57 make check
58 '';
59
60 meta = with lib; {
61 description = "Cython bindings for PARI";
62 license = licenses.gpl2Plus;
63 maintainers = teams.sage.members;
64 homepage = "https://github.com/defeo/cypari2";
65 };
66}