at 18.09-beta 2.0 kB view raw
1{ stdenv, buildPythonPackage, isPyPy, fetchPypi, libffi, pycparser, pytest }: 2 3if isPyPy then null else buildPythonPackage rec { 4 pname = "cffi"; 5 version = "1.11.5"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "e90f17980e6ab0f3c2f3730e56d1fe9bcba1891eeea58966e89d352492cc74f4"; 10 }; 11 12 outputs = [ "out" "dev" ]; 13 14 propagatedBuildInputs = [ libffi pycparser ]; 15 buildInputs = [ pytest ]; 16 17 # On Darwin, the cffi tests want to hit libm a lot, and look for it in a global 18 # impure search path. It's obnoxious how much repetition there is, and how difficult 19 # it is to get it to search somewhere else (since we do actually have a libm symlink in libSystem) 20 prePatch = stdenv.lib.optionalString stdenv.isDarwin '' 21 substituteInPlace testing/cffi0/test_parsing.py \ 22 --replace 'lib_m = "m"' 'lib_m = "System"' \ 23 --replace '"libm" in name' '"libSystem" in name' 24 substituteInPlace testing/cffi0/test_unicode_literals.py --replace 'lib_m = "m"' 'lib_m = "System"' 25 substituteInPlace testing/cffi0/test_zdistutils.py --replace 'self.lib_m = "m"' 'self.lib_m = "System"' 26 substituteInPlace testing/cffi1/test_recompiler.py --replace 'lib_m = "m"' 'lib_m = "System"' 27 substituteInPlace testing/cffi0/test_function.py --replace "lib_m = 'm'" "lib_m = 'System'" 28 substituteInPlace testing/cffi0/test_verify.py --replace "lib_m = ['m']" "lib_m = ['System']" 29 ''; 30 31 # The tests use -Werror but with python3.6 clang detects some unreachable code. 32 NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.cc.isClang [ "-Wno-unused-command-line-argument" "-Wno-unreachable-code" ]; 33 34 doCheck = !stdenv.hostPlatform.isMusl; # TODO: Investigate 35 checkPhase = '' 36 py.test 37 ''; 38 39 meta = with stdenv.lib; { 40 maintainers = with maintainers; [ domenkozar lnl7 ]; 41 homepage = https://cffi.readthedocs.org/; 42 license = with licenses; [ mit ]; 43 description = "Foreign Function Interface for Python calling C code"; 44 }; 45}