mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
80 lines
1.5 KiB
Nix
80 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
isPyPy,
|
|
pythonOlder,
|
|
setuptools,
|
|
gmp,
|
|
mpfr,
|
|
libmpc,
|
|
pytestCheckHook,
|
|
hypothesis,
|
|
cython,
|
|
mpmath,
|
|
# Reverse dependency
|
|
sage,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "gmpy2";
|
|
version = "2.2.0a2";
|
|
pyproject = true;
|
|
|
|
disabled = isPyPy || pythonOlder "3.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "aleaxit";
|
|
repo = "gmpy";
|
|
rev = "refs/tags/gmpy2-${version}";
|
|
hash = "sha256-luLEDEY1cezhzZo4fXmM/MUg2YyAaz7n0HwSpbNayP8=";
|
|
};
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
buildInputs = [
|
|
gmp
|
|
mpfr
|
|
libmpc
|
|
];
|
|
|
|
# make relative imports in tests work properly
|
|
preCheck = ''
|
|
rm gmpy2 -r
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
pytestCheckHook
|
|
hypothesis
|
|
cython
|
|
mpmath
|
|
];
|
|
|
|
disabledTests =
|
|
lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
|
|
# issue with some overflow logic
|
|
"test_mpz_to_bytes"
|
|
"test_mpz_from_bytes"
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
# TypeError: mpq() requires numeric or string argument
|
|
# not sure why it only fails on Darwin
|
|
"test_mpq_from_Decimal"
|
|
];
|
|
|
|
pythonImportsCheck = [ "gmpy2" ];
|
|
|
|
passthru.tests = {
|
|
inherit sage;
|
|
};
|
|
|
|
meta = {
|
|
changelog = "https://github.com/aleaxit/gmpy/blob/${src.rev}/docs/history.rst";
|
|
description = "Interface to GMP, MPFR, and MPC for Python 3.7+";
|
|
homepage = "https://github.com/aleaxit/gmpy/";
|
|
license = lib.licenses.lgpl3Plus;
|
|
maintainers = with lib.maintainers; [ tomasajt ];
|
|
};
|
|
}
|