2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
isPyPy,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
|
|
|
gmp,
|
|
|
|
mpfr,
|
|
|
|
libmpc,
|
|
|
|
pytestCheckHook,
|
|
|
|
hypothesis,
|
|
|
|
cython,
|
|
|
|
mpmath,
|
|
|
|
# Reverse dependency
|
|
|
|
sage,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "gmpy2";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "2.2.0a2";
|
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabled = isPyPy || pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aleaxit";
|
|
|
|
repo = "gmpy";
|
2024-06-05 15:53:02 +00:00
|
|
|
rev = "refs/tags/gmpy2-${version}";
|
|
|
|
hash = "sha256-luLEDEY1cezhzZo4fXmM/MUg2YyAaz7n0HwSpbNayP8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
gmp
|
|
|
|
mpfr
|
|
|
|
libmpc
|
|
|
|
];
|
|
|
|
|
|
|
|
# make relative imports in tests work properly
|
|
|
|
preCheck = ''
|
|
|
|
rm gmpy2 -r
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
hypothesis
|
|
|
|
cython
|
|
|
|
mpmath
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests =
|
2024-09-26 11:04:55 +00:00
|
|
|
lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
|
2024-06-05 15:53:02 +00:00
|
|
|
# issue with some overflow logic
|
|
|
|
"test_mpz_to_bytes"
|
|
|
|
"test_mpz_from_bytes"
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-06-05 15:53:02 +00:00
|
|
|
# TypeError: mpq() requires numeric or string argument
|
|
|
|
# not sure why it only fails on Darwin
|
|
|
|
"test_mpq_from_Decimal"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
pythonImportsCheck = [ "gmpy2" ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit sage;
|
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = {
|
|
|
|
changelog = "https://github.com/aleaxit/gmpy/blob/${src.rev}/docs/history.rst";
|
|
|
|
description = "Interface to GMP, MPFR, and MPC for Python 3.7+";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/aleaxit/gmpy/";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = lib.licenses.lgpl3Plus;
|
|
|
|
maintainers = with lib.maintainers; [ tomasajt ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|