at master 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 isPyPy, 6 fetchPypi, 7 setuptools, 8 pytestCheckHook, 9 libffi, 10 pkg-config, 11 pycparser, 12}: 13 14let 15 version = "1.17.1"; 16in 17if isPyPy then 18 buildPythonPackage { 19 pname = "cffi"; 20 inherit version; 21 pyproject = false; 22 23 # cffi is bundled with PyPy. 24 dontUnpack = true; 25 26 # Some dependent packages expect to have pycparser available when using cffi. 27 dependencies = [ pycparser ]; 28 29 meta = { 30 description = "Foreign Function Interface for Python calling C code (bundled with PyPy, placeholder package)"; 31 homepage = "https://cffi.readthedocs.org/"; 32 license = lib.licenses.mit; 33 teams = [ lib.teams.python ]; 34 }; 35 } 36else 37 buildPythonPackage rec { 38 pname = "cffi"; 39 inherit version; 40 pyproject = true; 41 42 src = fetchPypi { 43 inherit pname version; 44 hash = "sha256-HDnGAWwyvEjdVFYZUOvWg24WcPKuRhKPZ89J54nFKCQ="; 45 }; 46 47 nativeBuildInputs = [ pkg-config ]; 48 49 build-system = [ setuptools ]; 50 51 buildInputs = [ libffi ]; 52 53 dependencies = [ pycparser ]; 54 55 # The tests use -Werror but with python3.6 clang detects some unreachable code. 56 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument -Wno-unreachable-code -Wno-c++11-narrowing"; 57 58 doCheck = !(stdenv.hostPlatform.isMusl || stdenv.hostPlatform.useLLVM or false); 59 60 nativeCheckInputs = [ pytestCheckHook ]; 61 62 disabledTests = lib.optionals stdenv.hostPlatform.isFreeBSD [ 63 # https://github.com/python-cffi/cffi/pull/144 64 "test_dlopen_handle" 65 ]; 66 67 meta = with lib; { 68 changelog = "https://github.com/python-cffi/cffi/releases/tag/v${version}"; 69 description = "Foreign Function Interface for Python calling C code"; 70 downloadPage = "https://github.com/python-cffi/cffi"; 71 homepage = "https://cffi.readthedocs.org/"; 72 license = licenses.mit; 73 teams = [ teams.python ]; 74 }; 75 }