1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 isPyPy,
6 pythonAtLeast,
7 setuptools,
8 gmp,
9}:
10
11buildPythonPackage rec {
12 pname = "gmpy";
13 version = "1.17";
14 pyproject = true;
15
16 # Python 3.11 has finally made changes to its C API for which gmpy 1.17,
17 # published in 2013, would require patching. It seems unlikely that any
18 # patches will be forthcoming.
19 disabled = isPyPy || pythonAtLeast "3.11";
20
21 src = fetchFromGitHub {
22 owner = "aleaxit";
23 repo = "gmpy";
24 rev = "refs/tags/gmpy_${lib.replaceStrings [ "." ] [ "_" ] version}";
25 hash = "sha256-kMidOjhKJlDRu2qaiq9c+XcwD1tNAoPhRTvvGcOJe8I=";
26 };
27
28 build-system = [ setuptools ];
29
30 buildInputs = [ gmp ];
31
32 pythonImportsCheck = [ "gmpy" ];
33
34 meta = {
35 description = "GMP or MPIR interface to Python 2.4+ and 3.x";
36 homepage = "https://github.com/aleaxit/gmpy/";
37 license = lib.licenses.lgpl21Plus;
38 };
39}