at master 1.5 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 isPyPy, 7 setuptools, 8 gmp, 9 mpfr, 10 libmpc, 11 pytestCheckHook, 12 hypothesis, 13 cython, 14 mpmath, 15 # Reverse dependency 16 sage, 17}: 18 19buildPythonPackage rec { 20 pname = "gmpy2"; 21 version = "2.2.1"; 22 pyproject = true; 23 24 disabled = isPyPy; 25 26 src = fetchFromGitHub { 27 owner = "aleaxit"; 28 repo = "gmpy"; 29 tag = "v${version}"; 30 hash = "sha256-wrMN3kqLnjItoybKYeo4Pp2M0uma7Kg0JEQM8lr6OI0="; 31 }; 32 33 build-system = [ setuptools ]; 34 35 buildInputs = [ 36 gmp 37 mpfr 38 libmpc 39 ]; 40 41 # make relative imports in tests work properly 42 preCheck = '' 43 rm gmpy2 -r 44 ''; 45 46 nativeCheckInputs = [ 47 pytestCheckHook 48 hypothesis 49 cython 50 mpmath 51 ]; 52 53 disabledTests = 54 lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ 55 # issue with some overflow logic 56 "test_mpz_to_bytes" 57 "test_mpz_from_bytes" 58 ] 59 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 60 # TypeError: mpq() requires numeric or string argument 61 # not sure why it only fails on Darwin 62 "test_mpq_from_Decimal" 63 ]; 64 65 pythonImportsCheck = [ "gmpy2" ]; 66 67 passthru.tests = { 68 inherit sage; 69 }; 70 71 meta = { 72 changelog = "https://github.com/aleaxit/gmpy/blob/${src.rev}/docs/history.rst"; 73 description = "Interface to GMP, MPFR, and MPC for Python 3.7+"; 74 homepage = "https://github.com/aleaxit/gmpy/"; 75 license = lib.licenses.lgpl3Plus; 76 maintainers = with lib.maintainers; [ tomasajt ]; 77 }; 78}