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