pycapnp: adopt, cleanup
This commit is contained in:
parent
75e31ca6b2
commit
e12a71c717
@ -1,29 +1,41 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
capnproto,
|
||||
cython,
|
||||
replaceVars,
|
||||
fetchFromGitHub,
|
||||
fetchpatch2,
|
||||
isPy27,
|
||||
isPyPy,
|
||||
setuptools,
|
||||
wheel,
|
||||
capnproto,
|
||||
cython,
|
||||
pkgconfig,
|
||||
pytest-asyncio,
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pycapnp";
|
||||
version = "2.0.0";
|
||||
format = "setuptools";
|
||||
disabled = isPyPy || isPy27;
|
||||
format = "pyproject";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "capnproto";
|
||||
repo = "pycapnp";
|
||||
tag = "v${version}";
|
||||
sha256 = "sha256-SVeBRJMMR1Z8+S+QoiUKGRFGUPS/MlmWLi1qRcGcPoE=";
|
||||
hash = "sha256-SVeBRJMMR1Z8+S+QoiUKGRFGUPS/MlmWLi1qRcGcPoE=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# pycapnp hardcodes /usr/include and /usr/local/include as the paths to search
|
||||
# for capnproto's built-in schemas in; replace them with the path to our copy of
|
||||
# capnproto.
|
||||
#
|
||||
# Theoretically, this mechanism could also be used to load capnproto schemas
|
||||
# exposed by other packages (e.g. capnproto-java), which we could support using
|
||||
# a setup hook; but in practice nobody seems to use this mechanism for anything
|
||||
# other than the builtin schemas (based on quick GitHub code search), so I don't
|
||||
# think it's worthwhile.
|
||||
(replaceVars ./include-paths.patch { inherit capnproto; })
|
||||
(fetchpatch2 {
|
||||
name = "cython-3.patch";
|
||||
url = "https://github.com/capnproto/pycapnp/pull/334.diff?full_index=1";
|
||||
@ -31,21 +43,34 @@ buildPythonPackage rec {
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
cython
|
||||
pkgconfig
|
||||
];
|
||||
|
||||
buildInputs = [ capnproto ];
|
||||
|
||||
# Tests depend on schema_capnp which fails to generate
|
||||
doCheck = false;
|
||||
nativeCheckInputs = [
|
||||
pytest-asyncio
|
||||
pytestCheckHook
|
||||
];
|
||||
__darwinAllowLocalNetworking = true;
|
||||
# https://github.com/NixOS/nixpkgs/issues/255262
|
||||
preCheck = ''
|
||||
enabledTestPaths=$PWD/test
|
||||
pushd "$out"
|
||||
'';
|
||||
postCheck = ''
|
||||
popd
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "capnp" ];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Cython wrapping of the C++ Cap'n Proto library";
|
||||
homepage = "https://capnproto.github.io/pycapnp/";
|
||||
maintainers = [ ];
|
||||
license = licenses.bsd2;
|
||||
changelog = "https://github.com/capnproto/pycapnp/blob/${src.rev}/CHANGELOG.md";
|
||||
license = lib.licenses.bsd2;
|
||||
maintainers = with lib.maintainers; [ Liamolucko ];
|
||||
};
|
||||
}
|
||||
|
14
pkgs/development/python-modules/pycapnp/include-paths.patch
Normal file
14
pkgs/development/python-modules/pycapnp/include-paths.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/capnp/lib/capnp.pyx
|
||||
+++ b/capnp/lib/capnp.pyx
|
||||
@@ -4410,10 +4410,7 @@ def load(file_name, display_name=None, imports=[]):
|
||||
# Automatically include the system and built-in capnp paths
|
||||
# Highest priority at position 0
|
||||
_capnp_paths = [
|
||||
- # Common macOS brew location
|
||||
- '/usr/local/include',
|
||||
- # Common posix location
|
||||
- '/usr/include',
|
||||
+ '@capnproto@/include',
|
||||
]
|
||||
|
||||
class _Loader:
|
Loading…
x
Reference in New Issue
Block a user