1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitLab,
6 setuptools,
7 pkg-config,
8 lxml,
9 libvirt,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "libvirt";
15 version = "11.7.0";
16 pyproject = true;
17
18 src = fetchFromGitLab {
19 owner = "libvirt";
20 repo = "libvirt-python";
21 tag = "v${version}";
22 hash = "sha256-1YyWGwotk1Zv0zsNDGmWXhIFYEEN5qgYrB0j2QDTZFY=";
23 };
24
25 postPatch = ''
26 substituteInPlace setup.py \
27 --replace-fail 'pkg-config' "${stdenv.cc.targetPrefix}pkg-config"
28 '';
29
30 build-system = [ setuptools ];
31
32 nativeBuildInputs = [ pkg-config ];
33 buildInputs = [
34 libvirt
35 lxml
36 ];
37
38 pythonImportsCheck = [ "libvirt" ];
39
40 nativeCheckInputs = [ pytestCheckHook ];
41
42 meta = with lib; {
43 homepage = "https://libvirt.org/python.html";
44 description = "Libvirt Python bindings";
45 license = licenses.lgpl2;
46 maintainers = [ maintainers.fpletz ];
47 };
48}