1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, python
6, glibcLocales
7, pkgconfig
8, gdb
9, numpy
10, ncurses
11}:
12
13let
14 excludedTests = []
15 ++ [ "reimport_from_subinterpreter" ]
16 # cython's testsuite is not working very well with libc++
17 # We are however optimistic about things outside of testsuite still working
18 ++ stdenv.lib.optionals (stdenv.cc.isClang or false) [ "cpdef_extern_func" "libcpp_algo" ]
19 # Some tests in the test suite isn't working on aarch64. Disable them for
20 # now until upstream finds a workaround.
21 # Upstream issue here: https://github.com/cython/cython/issues/2308
22 ++ stdenv.lib.optionals stdenv.isAarch64 [ "numpy_memoryview" ]
23 ++ stdenv.lib.optionals stdenv.isi686 [ "future_division" "overflow_check_longlong" ]
24 ;
25
26in buildPythonPackage rec {
27 pname = "Cython";
28 version = "0.29.13";
29
30 src = fetchPypi {
31 inherit pname version;
32 sha256 = "c29d069a4a30f472482343c866f7486731ad638ef9af92bfe5fca9c7323d638e";
33 };
34
35 nativeBuildInputs = [
36 pkgconfig
37 ];
38 checkInputs = [
39 numpy ncurses
40 ];
41 buildInputs = [ glibcLocales gdb ];
42 LC_ALL = "en_US.UTF-8";
43
44 checkPhase = ''
45 export HOME="$NIX_BUILD_TOP"
46 ${python.interpreter} runtests.py -j$NIX_BUILD_CORES \
47 --no-code-style \
48 ${stdenv.lib.optionalString (builtins.length excludedTests != 0)
49 ''--exclude="(${builtins.concatStringsSep "|" excludedTests})"''}
50 '';
51
52 # https://github.com/cython/cython/issues/2785
53 # Temporary solution
54 doCheck = false;
55
56# doCheck = !stdenv.isDarwin;
57
58
59 meta = {
60 description = "An optimising static compiler for both the Python programming language and the extended Cython programming language";
61 homepage = https://cython.org;
62 license = lib.licenses.asl20;
63 maintainers = with lib.maintainers; [ fridh ];
64 };
65}