1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, isPy3k
6, python
7, glibcLocales
8, pkgconfig
9, gdb
10, numpy
11, ncurses
12}:
13
14buildPythonPackage rec {
15 pname = "Cython";
16 name = "${pname}-${version}";
17 version = "0.26.1";
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "c2e63c4794161135adafa8aa4a855d6068073f421c83ffacc39369497a189dd5";
22 };
23
24 # With Python 2.x on i686-linux or 32-bit ARM this test fails because the
25 # result is "3L" instead of "3", so let's fix it in-place.
26 #
27 # Upstream issue: https://github.com/cython/cython/issues/1548
28 postPatch = lib.optionalString ((stdenv.isi686 || stdenv.isArm) && !isPy3k) ''
29 sed -i -e 's/\(>>> *\)\(verify_resolution_GH1533()\)/\1int(\2)/' \
30 tests/run/cpdef_enums.pyx
31 '';
32
33 buildInputs = [ glibcLocales pkgconfig gdb ];
34 # For testing
35 nativeBuildInputs = [ numpy ncurses ];
36
37 LC_ALL = "en_US.UTF-8";
38
39 # cython's testsuite is not working very well with libc++
40 # We are however optimistic about things outside of testsuite still working
41 checkPhase = ''
42 export HOME="$NIX_BUILD_TOP"
43 ${python.interpreter} runtests.py \
44 ${if stdenv.cc.isClang or false then ''--exclude="(cpdef_extern_func|libcpp_algo)"'' else ""}
45 '';
46
47 # Disable tests temporarily
48 # https://github.com/cython/cython/issues/1676
49 doCheck = false;
50
51 meta = {
52 description = "An optimising static compiler for both the Python programming language and the extended Cython programming language";
53 homepage = http://cython.org;
54 license = lib.licenses.asl20;
55 maintainers = with lib.maintainers; [ fridh ];
56 };
57}