at master 2.0 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 replaceVars, 5 fetchFromGitHub, 6 fetchpatch2, 7 setuptools, 8 wheel, 9 capnproto, 10 cython, 11 pkgconfig, 12 pytest-asyncio, 13 pytestCheckHook, 14}: 15 16buildPythonPackage rec { 17 pname = "pycapnp"; 18 version = "2.0.0"; 19 format = "pyproject"; 20 21 src = fetchFromGitHub { 22 owner = "capnproto"; 23 repo = "pycapnp"; 24 tag = "v${version}"; 25 hash = "sha256-SVeBRJMMR1Z8+S+QoiUKGRFGUPS/MlmWLi1qRcGcPoE="; 26 }; 27 28 patches = [ 29 # pycapnp hardcodes /usr/include and /usr/local/include as the paths to search 30 # for capnproto's built-in schemas in; replace them with the path to our copy of 31 # capnproto. 32 # 33 # Theoretically, this mechanism could also be used to load capnproto schemas 34 # exposed by other packages (e.g. capnproto-java), which we could support using 35 # a setup hook; but in practice nobody seems to use this mechanism for anything 36 # other than the builtin schemas (based on quick GitHub code search), so I don't 37 # think it's worthwhile. 38 (replaceVars ./include-paths.patch { inherit capnproto; }) 39 (fetchpatch2 { 40 name = "cython-3.patch"; 41 url = "https://github.com/capnproto/pycapnp/pull/334.diff?full_index=1"; 42 hash = "sha256-we7v4RaL7c1tePWl+oYfzMHAfnvnpdMkQgVu9YLwC6Y="; 43 }) 44 ]; 45 46 build-system = [ 47 setuptools 48 wheel 49 cython 50 pkgconfig 51 ]; 52 53 buildInputs = [ capnproto ]; 54 55 nativeCheckInputs = [ 56 pytest-asyncio 57 pytestCheckHook 58 ]; 59 __darwinAllowLocalNetworking = true; 60 # https://github.com/NixOS/nixpkgs/issues/255262 61 preCheck = '' 62 enabledTestPaths=$PWD/test 63 pushd "$out" 64 ''; 65 postCheck = '' 66 popd 67 ''; 68 69 meta = { 70 description = "Cython wrapping of the C++ Cap'n Proto library"; 71 homepage = "https://capnproto.github.io/pycapnp/"; 72 changelog = "https://github.com/capnproto/pycapnp/blob/${src.rev}/CHANGELOG.md"; 73 license = lib.licenses.bsd2; 74 maintainers = with lib.maintainers; [ Liamolucko ]; 75 }; 76}