1{ lib
2, fetchFromGitHub
3, fetchpatch
4, buildPythonPackage
5, pkgconfig
6, gmp
7, pari
8, mpfr
9, fplll
10, cython
11, cysignals
12, numpy
13, pytest
14}:
15
16buildPythonPackage rec {
17 pname = "fpylll";
18 version = "0.5.1dev";
19
20 src = fetchFromGitHub {
21 owner = "fplll";
22 repo = "fpylll";
23 rev = version;
24 sha256 = "15vdfgx448mr1nf054h7lr2j3dd35fsfhikqzrh9zsng8n12hxa5";
25 };
26
27 patches = [
28 # two patches to fix the testsuite on aarch64 (https://github.com/fplll/fpylll/issues/162)
29 (fetchpatch {
30 url = "https://github.com/fplll/fpylll/commit/d5809a8fdb86b2693b1fa94e655bbbe4ad80e286.patch";
31 name = "less-precision-in-tests.patch";
32 sha256 = "0vkvi25nwwvk5r4a4xmkbf060di4hjq32bys75l2hsaysxmk93nz";
33 })
34 (fetchpatch {
35 url = "https://github.com/fplll/fpylll/commit/b5b146a010d50da219a313adc4b6f7deddcc146b.patch";
36 name = "dont-hardcode-precision.patch";
37 sha256 = "1rsbwh90i1j5p2rp6jd5n25v1jzw1n8728fzz1lhb91zmk0hlxc9";
38 })
39 ];
40
41 buildInputs = [
42 gmp
43 pari
44 mpfr
45 fplll
46 ];
47
48 propagatedBuildInputs = [
49 cython
50 cysignals
51 numpy
52 ];
53
54 nativeBuildInputs = [
55 pkgconfig
56 ];
57
58 checkInputs = [
59 pytest
60 ];
61
62 checkPhase = ''
63 # Since upstream introduced --doctest-modules in
64 # https://github.com/fplll/fpylll/commit/9732fdb40cf1bd43ad1f60762ec0a8401743fc79,
65 # it is necessary to ignore import mismatches. Not sure why, but the files
66 # should be identical anyway.
67 PY_IGNORE_IMPORTMISMATCH=1 pytest
68 '';
69
70 meta = with lib; {
71 description = "A Python interface for fplll";
72 changelog = "https://github.com/fplll/fpylll/releases/tag/${version}";
73 homepage = "https://github.com/fplll/fpylll";
74 maintainers = teams.sage.members;
75 license = licenses.gpl2Plus;
76 };
77}