1{
2 lib,
3 buildPythonPackage,
4 python,
5 fetchPypi,
6 pari,
7 gmp,
8 cython,
9 cysignals,
10
11 # Reverse dependency
12 sage,
13}:
14
15buildPythonPackage rec {
16 pname = "cypari2";
17 # upgrade may break sage, please test the sage build or ping @timokau on upgrade
18 version = "2.2.2";
19 format = "setuptools";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-E6M4c16iIcEGj4/EFVYb93fYxoclcCvHSVRyZP0JFyA=";
24 };
25
26 preBuild = ''
27 # generate cythonized extensions (auto_paridecl.pxd is crucial)
28 ${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
29 '';
30
31 nativeBuildInputs = [ pari ];
32
33 buildInputs = [ gmp ];
34
35 propagatedBuildInputs = [
36 cysignals
37 cython
38 ];
39
40 checkPhase = ''
41 test -f "$out/${python.sitePackages}/cypari2/auto_paridecl.pxd"
42 make check
43 '';
44
45 passthru.tests = {
46 inherit sage;
47 };
48
49 meta = with lib; {
50 description = "Cython bindings for PARI";
51 license = licenses.gpl2Plus;
52 teams = [ teams.sage ];
53 homepage = "https://github.com/defeo/cypari2";
54 };
55}