1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 fetchpatch,
6
7 # build-system
8 cysignals,
9 cython,
10 pkgconfig,
11 setuptools,
12
13 gmp,
14 pari,
15 mpfr,
16 fplll,
17 numpy,
18
19 # Reverse dependency
20 sage,
21
22 # tests
23 pytestCheckHook,
24}:
25
26buildPythonPackage rec {
27 pname = "fpylll";
28 version = "0.6.1";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "fplll";
33 repo = "fpylll";
34 rev = "refs/tags/${version}";
35 hash = "sha256-M3ZnDL0Ui3UAa5Jn/Wr5pAHhghP7EAaQD/sx5QZ58ZQ=";
36 };
37
38 patches = [
39 (fetchpatch {
40 url = "https://github.com/fplll/fpylll/commit/fc432b21fa7e4b9891f5b761b3539989eb958f2b.diff";
41 hash = "sha256-+UidQ5xnlmjeVeVvR4J2zDzAuXP5LUPXCh4RP4o9oGA=";
42 })
43 (fetchpatch {
44 url = "https://github.com/fplll/fpylll/commit/cece9c9b182dc3ac2c9121549cb427ccf4c4a9fe.diff";
45 hash = "sha256-epJb8gorQ7gEEylZ2yZFdM9+EZ4ys9mUUUPiJ2D0VOM=";
46 })
47 ];
48
49 nativeBuildInputs = [
50 cython
51 cysignals
52 pkgconfig
53 setuptools
54 ];
55
56 buildInputs = [
57 gmp
58 pari
59 mpfr
60 fplll
61 ];
62
63 propagatedBuildInputs = [ numpy ];
64
65 nativeCheckInputs = [ pytestCheckHook ];
66
67 preCheck = ''
68 # Since upstream introduced --doctest-modules in
69 # https://github.com/fplll/fpylll/commit/9732fdb40cf1bd43ad1f60762ec0a8401743fc79,
70 # it is necessary to ignore import mismatches. Not sure why, but the files
71 # should be identical anyway.
72 export PY_IGNORE_IMPORTMISMATCH=1
73 '';
74
75 passthru.tests = {
76 inherit sage;
77 };
78
79 meta = with lib; {
80 description = "A Python interface for fplll";
81 changelog = "https://github.com/fplll/fpylll/releases/tag/${version}";
82 homepage = "https://github.com/fplll/fpylll";
83 maintainers = teams.sage.members;
84 license = licenses.gpl2Plus;
85 };
86}