nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 setuptools,
8 cython,
9 gmp,
10 pari,
11 perl,
12}:
13
14buildPythonPackage rec {
15 pname = "cypari";
16 version = "2.5.5";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "3-manifolds";
21 repo = "CyPari";
22 tag = "${version}_as_released";
23 hash = "sha256-RJ9O1KsDHmMkTCIFUrcSUkA5ijTsxmoI939QCsCib0Y=";
24 };
25
26 patches = [
27 (fetchpatch {
28 name = "support-aarch64-linux.patch";
29 url = "https://github.com/3-manifolds/CyPari/commit/6197171b52ee4f44a4954ddd0e2e36769b189dee.patch";
30 hash = "sha256-j2P7DEGD2B8q9Hh4G2mQng76fQdUpeAdFYoTD7Ui/Dk=";
31 })
32 (fetchpatch {
33 name = "fix-build-with-cython-3_1.patch";
34 url = "https://github.com/3-manifolds/CyPari/compare/622e112ffcf0383e2110954ff3ac3c42c006ebe1...50bcbd2b39177f5e4c5a3551a8a14f75ab05a5d6.patch";
35 hash = "sha256-6ayvtHMS3YtzzklHaaLzl9d4zHJhm0lVZQZFS9ykFY4=";
36 })
37 ];
38
39 preBuild = ''
40 mkdir libcache
41 ln -s ${gmp} libcache/gmp
42 ln -s ${pari} libcache/pari
43 '';
44
45 build-system = [
46 setuptools
47 cython
48 ];
49
50 nativeBuildInputs = [
51 perl
52 ];
53
54 pythonImportsCheck = [ "cypari" ];
55
56 checkPhase = ''
57 runHook preCheck
58 ${python.interpreter} -P -m cypari.test
59 runHook postCheck
60 '';
61
62 meta = {
63 description = "Sage's PARI extension, modified to stand alone";
64 homepage = "https://github.com/3-manifolds/CyPari";
65 license = lib.licenses.gpl2Plus;
66 maintainers = with lib.maintainers; [
67 noiioiu
68 alejo7797
69 ];
70 changelog = "https://github.com/3-manifolds/CyPari/releases/tag/${src.tag}";
71 };
72}