at 25.11-pre 3.8 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 gdb, 6 ncurses, 7 numpy, 8 pkg-config, 9 pygame-ce, 10 python, 11 sage, # Reverse dependency 12 setuptools, 13 stdenv, 14}: 15 16buildPythonPackage rec { 17 pname = "cython"; 18 version = "3.0.12"; 19 pyproject = true; 20 21 src = fetchFromGitHub { 22 owner = "cython"; 23 repo = "cython"; 24 tag = version; 25 hash = "sha256-clJXjQb6rVECirKRUGX0vD5a6LILzPwNo7+6KKYs2pI="; 26 }; 27 28 build-system = [ 29 pkg-config 30 setuptools 31 ]; 32 33 nativeCheckInputs = [ 34 gdb 35 numpy 36 ncurses 37 ]; 38 39 env.LC_ALL = "en_US.UTF-8"; 40 41 # https://github.com/cython/cython/issues/2785 42 # Temporary solution 43 doCheck = false; 44 45 strictDeps = true; 46 47 checkPhase = 48 let 49 excludedTests = 50 [ "reimport_from_subinterpreter" ] 51 # cython's testsuite is not working very well with libc++ 52 # We are however optimistic about things outside of testsuite still working 53 ++ lib.optionals (stdenv.cc.isClang or false) [ 54 "cpdef_extern_func" 55 "libcpp_algo" 56 ] 57 # Some tests in the test suite aren't working on aarch64. 58 # Disable them for now until upstream finds a workaround. 59 # Upstream issue: https://github.com/cython/cython/issues/2308 60 ++ lib.optionals stdenv.hostPlatform.isAarch64 [ "numpy_memoryview" ] 61 ++ lib.optionals stdenv.hostPlatform.isi686 [ 62 "future_division" 63 "overflow_check_longlong" 64 ]; 65 commandline = builtins.concatStringsSep " " ( 66 [ 67 "-j$NIX_BUILD_CORES" 68 "--no-code-style" 69 ] 70 ++ lib.optionals (builtins.length excludedTests != 0) [ 71 ''--exclude="(${builtins.concatStringsSep "|" excludedTests})"'' 72 ] 73 ); 74 in 75 '' 76 runHook preCheck 77 export HOME="$NIX_BUILD_TOP" 78 ${python.interpreter} runtests.py ${commandline} 79 runHook postCheck 80 ''; 81 82 passthru.tests = { 83 inherit pygame-ce sage; 84 }; 85 86 # Force code regeneration in source distributions 87 # https://github.com/cython/cython/issues/5089 88 setupHook = ./setup-hook.sh; 89 90 meta = { 91 homepage = "https://cython.org"; 92 description = "Optimising static compiler for both the Python and the extended Cython programming languages"; 93 longDescription = '' 94 Cython is an optimising static compiler for both the Python programming 95 language and the extended Cython programming language (based on Pyrex). It 96 makes writing C extensions for Python as easy as Python itself. 97 98 Cython gives you the combined power of Python and C to let you: 99 100 - write Python code that calls back and forth from and to C or C++ code 101 natively at any point. 102 - easily tune readable Python code into plain C performance by adding 103 static type declarations, also in Python syntax. 104 - use combined source code level debugging to find bugs in your Python, 105 Cython and C code. 106 - interact efficiently with large data sets, e.g. using multi-dimensional 107 NumPy arrays. 108 - quickly build your applications within the large, mature and widely used 109 CPython ecosystem. 110 - integrate natively with existing code and data from legacy, low-level or 111 high-performance libraries and applications. 112 113 The Cython language is a superset of the Python language that additionally 114 supports calling C functions and declaring C types on variables and class 115 attributes. This allows the compiler to generate very efficient C code 116 from Cython code. 117 ''; 118 changelog = "https://github.com/cython/cython/blob/${version}/CHANGES.rst"; 119 license = lib.licenses.asl20; 120 mainProgram = "cython"; 121 maintainers = with lib.maintainers; [ ]; 122 }; 123} 124# TODO: investigate recursive loop when doCheck is true