nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 isPyPy,
6 setuptools,
7 gmp,
8 mpfr,
9 libmpc,
10 pytestCheckHook,
11 hypothesis,
12 cython,
13 mpmath,
14 # Reverse dependency
15 sage,
16}:
17
18buildPythonPackage (finalAttrs: {
19 pname = "gmpy2";
20 version = "2.2.2";
21 pyproject = true;
22
23 disabled = isPyPy;
24
25 src = fetchFromGitHub {
26 owner = "aleaxit";
27 repo = "gmpy";
28 tag = "v${finalAttrs.version}";
29 hash = "sha256-joeHec/d82sovfASCU3nlNL6SaThnS/XYPqujiZ9h8s=";
30 };
31
32 build-system = [ setuptools ];
33
34 buildInputs = [
35 gmp
36 mpfr
37 libmpc
38 ];
39
40 # make relative imports in tests work properly
41 preCheck = ''
42 rm gmpy2 -r
43 '';
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 hypothesis
48 cython
49 mpmath
50 ];
51
52 pythonImportsCheck = [ "gmpy2" ];
53
54 passthru.tests = {
55 inherit sage;
56 };
57
58 meta = {
59 changelog = "https://github.com/aleaxit/gmpy/blob/${finalAttrs.src.rev}/docs/history.rst";
60 description = "Interface to GMP, MPFR, and MPC for Python 3.7+";
61 homepage = "https://github.com/aleaxit/gmpy/";
62 license = lib.licenses.lgpl3Plus;
63 maintainers = with lib.maintainers; [ tomasajt ];
64 };
65})