at 22.05-pre 2.8 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, fetchPypi 5, fetchpatch 6, python 7, glibcLocales 8, pkg-config 9, gdb 10, numpy 11, ncurses 12}: 13 14let 15 excludedTests = [ "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 ++ 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 ++ lib.optionals stdenv.isAarch64 [ "numpy_memoryview" ] 23 ++ lib.optionals stdenv.isi686 [ "future_division" "overflow_check_longlong" ] 24 ; 25 26in buildPythonPackage rec { 27 pname = "Cython"; 28 version = "0.29.24"; 29 30 src = fetchPypi { 31 inherit pname version; 32 sha256 = "sha256-zfBNB8NgCGDowuuq1Oj1KsP+shJFPBdkpJrAjIJ+hEM="; 33 }; 34 35 nativeBuildInputs = [ 36 pkg-config 37 ]; 38 39 checkInputs = [ 40 gdb numpy ncurses 41 ]; 42 43 buildInputs = [ glibcLocales ]; 44 LC_ALL = "en_US.UTF-8"; 45 46 patches = [ 47 # https://github.com/cython/cython/issues/2752, needed by sage (https://trac.sagemath.org/ticket/26855) and up to be included in 0.30 48 (fetchpatch { 49 name = "non-int-conversion-to-pyhash.patch"; 50 url = "https://github.com/cython/cython/commit/28251032f86c266065e4976080230481b1a1bb29.patch"; 51 sha256 = "19rg7xs8gr90k3ya5c634bs8gww1sxyhdavv07cyd2k71afr83gy"; 52 }) 53 54 # backport Cython 3.0 trashcan support (https://github.com/cython/cython/pull/2842) to 0.X series. 55 # it does not affect Python code unless the code explicitly uses the feature. 56 # trashcan support is needed to avoid stack overflows during object deallocation in sage (https://trac.sagemath.org/ticket/27267) 57 (fetchpatch { 58 name = "trashcan.patch"; 59 url = "https://git.sagemath.org/sage.git/plain/build/pkgs/cython/patches/trashcan.patch?id=4569a839f070a1a38d5dbce2a4d19233d25aeed2"; 60 sha256 = "sha256-+pOF1XNTEtNseLpqPzrc1Jfwt5hGx7doUoccIhNneYY="; 61 }) 62 ]; 63 64 checkPhase = '' 65 export HOME="$NIX_BUILD_TOP" 66 ${python.interpreter} runtests.py -j$NIX_BUILD_CORES \ 67 --no-code-style \ 68 ${lib.optionalString (builtins.length excludedTests != 0) 69 ''--exclude="(${builtins.concatStringsSep "|" excludedTests})"''} 70 ''; 71 72 # https://github.com/cython/cython/issues/2785 73 # Temporary solution 74 doCheck = false; 75 # doCheck = !stdenv.isDarwin; 76 77 meta = { 78 description = "An optimising static compiler for both the Python programming language and the extended Cython programming language"; 79 homepage = "https://cython.org"; 80 license = lib.licenses.asl20; 81 maintainers = with lib.maintainers; [ fridh ]; 82 }; 83}