2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchPypi,
|
|
|
|
setuptools,
|
|
|
|
python,
|
|
|
|
pkg-config,
|
|
|
|
gdb,
|
|
|
|
numpy,
|
|
|
|
ncurses,
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# Reverse dependency
|
|
|
|
sage,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-06-05 15:53:02 +00:00
|
|
|
excludedTests =
|
|
|
|
[ "reimport_from_subinterpreter" ]
|
2020-04-24 23:36:52 +00:00
|
|
|
# cython's testsuite is not working very well with libc++
|
|
|
|
# We are however optimistic about things outside of testsuite still working
|
2024-06-05 15:53:02 +00:00
|
|
|
++ lib.optionals (stdenv.cc.isClang or false) [
|
|
|
|
"cpdef_extern_func"
|
|
|
|
"libcpp_algo"
|
|
|
|
]
|
2020-04-24 23:36:52 +00:00
|
|
|
# Some tests in the test suite isn't working on aarch64. Disable them for
|
|
|
|
# now until upstream finds a workaround.
|
|
|
|
# Upstream issue here: https://github.com/cython/cython/issues/2308
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isAarch64 [ "numpy_memoryview" ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isi686 [
|
2024-06-05 15:53:02 +00:00
|
|
|
"future_division"
|
|
|
|
"overflow_check_longlong"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
2022-07-14 12:49:19 +00:00
|
|
|
pname = "cython";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "3.0.11";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
2024-09-19 14:19:46 +00:00
|
|
|
pname = "cython";
|
2022-07-14 12:49:19 +00:00
|
|
|
inherit version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-cUbdKvhoK0ymEzGFHmrrzp/lFY51MAND+AwHyoCx+v8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
2020-06-18 07:06:33 +00:00
|
|
|
pkg-config
|
2024-01-13 08:15:51 +00:00
|
|
|
setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2024-06-05 15:53:02 +00:00
|
|
|
gdb
|
|
|
|
numpy
|
|
|
|
ncurses
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
env.LC_ALL = "en_US.UTF-8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
export HOME="$NIX_BUILD_TOP"
|
|
|
|
${python.interpreter} runtests.py -j$NIX_BUILD_CORES \
|
|
|
|
--no-code-style \
|
2024-06-05 15:53:02 +00:00
|
|
|
${
|
|
|
|
lib.optionalString (
|
|
|
|
builtins.length excludedTests != 0
|
|
|
|
) ''--exclude="(${builtins.concatStringsSep "|" excludedTests})"''
|
|
|
|
}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# https://github.com/cython/cython/issues/2785
|
|
|
|
# Temporary solution
|
|
|
|
doCheck = false;
|
2024-09-26 11:04:55 +00:00
|
|
|
# doCheck = !stdenv.hostPlatform.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit sage;
|
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
# force regeneration of generated code in source distributions
|
|
|
|
# https://github.com/cython/cython/issues/5089
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2023-02-16 17:41:37 +00:00
|
|
|
changelog = "https://github.com/cython/cython/blob/${version}/CHANGES.rst";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Optimising static compiler for both the Python programming language and the extended Cython programming language";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://cython.org";
|
|
|
|
license = lib.licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|