1{
2 lib,
3 autoreconfHook,
4 fetchPypi,
5 buildPythonPackage,
6 cython,
7 pariSupport ? true,
8 pari, # for interfacing with the PARI/GP signal handler
9
10 # Reverse dependency
11 sage,
12}:
13
14assert pariSupport -> pari != null;
15
16buildPythonPackage rec {
17 pname = "cysignals";
18 version = "1.11.4";
19 format = "setuptools";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-Dx4yHlWgf5AchqNqHkSX9v+d/nAGgdATCjjDbk6yOMM=";
24 };
25
26 # explicit check:
27 # build/src/cysignals/implementation.c:27:2: error: #error "cysignals must be compiled without _FORTIFY_SOURCE"
28 hardeningDisable = [ "fortify" ];
29
30 # known failure: https://github.com/sagemath/cysignals/blob/582dbf6a7b0f9ade0abe7a7b8720b7fb32435c3c/testgdb.py#L5
31 doCheck = false;
32 checkTarget = "check-install";
33
34 preCheck = ''
35 # Make sure cysignals-CSI is in PATH
36 export PATH="$out/bin:$PATH"
37 '';
38
39 propagatedBuildInputs =
40 [ cython ]
41 ++ lib.optionals pariSupport [
42 # When cysignals is built with pari, including cysignals into the
43 # buildInputs of another python package will cause cython to link against
44 # pari.
45 pari
46 ];
47
48 nativeBuildInputs = [ autoreconfHook ];
49
50 enableParallelBuilding = true;
51
52 passthru.tests = {
53 inherit sage;
54 };
55
56 meta = with lib; {
57 description = "Interrupt and signal handling for Cython";
58 mainProgram = "cysignals-CSI";
59 homepage = "https://github.com/sagemath/cysignals/";
60 maintainers = teams.sage.members;
61 license = licenses.lgpl3Plus;
62 };
63}