Merge pull request #196295 from chuangzhu/py-libzfs

python310Packages.py-libzfs: init at 22.2.1
This commit is contained in:
Fabian Affolter 2022-10-18 23:42:07 +02:00 committed by GitHub
commit 449660ef7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,44 @@
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, cython
, zfs
}:
buildPythonPackage rec {
pname = "py-libzfs";
version = "22.02.4";
src = fetchFromGitHub {
owner = "truenas";
repo = pname;
rev = "TS-${version}";
sha256 = "sha256-BJG+cw07Qu4aL99pVKNd7JAgr+w/6Uv2eI46EB615/I=";
};
nativeBuildInputs = [ cython ];
buildInputs = [ zfs ];
# Passing CFLAGS in configureFlags does not work, see https://github.com/truenas/py-libzfs/issues/107
postPatch = lib.optionalString stdenv.isLinux ''
substituteInPlace configure \
--replace \
'CFLAGS="-DCYTHON_FALLTHROUGH"' \
'CFLAGS="-DCYTHON_FALLTHROUGH -I${zfs.dev}/include/libzfs -I${zfs.dev}/include/libspl"' \
--replace 'zof=false' 'zof=true'
'';
pythonImportsCheck = [ "libzfs" ];
meta = with lib; {
description = "Python libzfs bindings";
homepage = "https://github.com/truenas/py-libzfs";
license = licenses.bsd2;
maintainers = with maintainers; [ chuangzhu ];
# The project also supports macOS (OpenZFS on OSX, O3X), FreeBSD and OpenSolaris
# I don't have a machine to test out, thus only packaged for Linux
platforms = platforms.linux;
};
}

View file

@ -8113,6 +8113,8 @@ in {
pylitterbot = callPackage ../development/python-modules/pylitterbot { };
py-libzfs = callPackage ../development/python-modules/py-libzfs { };
py-lru-cache = callPackage ../development/python-modules/py-lru-cache { };
pylnk3 = callPackage ../development/python-modules/pylnk3 { };