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.27.3";
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "6a00512de1f2e3ce66ba35c5420babaef1fe2d9c43a8faab4080b0dbcc26bc64";
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 nativeBuildInputs = [
34 pkgconfig
35 # For testing
36 numpy ncurses
37 ];
38 buildInputs = [ glibcLocales gdb ];
39 LC_ALL = "en_US.UTF-8";
40
41 # cython's testsuite is not working very well with libc++
42 # We are however optimistic about things outside of testsuite still working
43 checkPhase = ''
44 export HOME="$NIX_BUILD_TOP"
45 ${python.interpreter} runtests.py \
46 ${if stdenv.cc.isClang or false then ''--exclude="(cpdef_extern_func|libcpp_algo)"'' else ""}
47 '';
48
49 # Disable tests temporarily
50 # https://github.com/cython/cython/issues/1676
51 doCheck = false;
52
53 meta = {
54 description = "An optimising static compiler for both the Python programming language and the extended Cython programming language";
55 homepage = http://cython.org;
56 license = lib.licenses.asl20;
57 maintainers = with lib.maintainers; [ fridh ];
58 };
59}