1{
2 buildPythonPackage,
3 lib,
4 fetchPypi,
5 setuptools,
6 systemd,
7 lxml,
8 psutil,
9 pytest,
10 mock,
11 pkg-config,
12 cython,
13}:
14
15buildPythonPackage rec {
16 pname = "pystemd";
17 version = "0.13.2";
18 pyproject = true;
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-Tc+ksTpVaFxJ09F8EGMeyhjDN3D2Yxb47yM3uJUcwUQ=";
23 };
24
25 postPatch = ''
26 # remove cythonized sources, build them anew to support more python version
27 rm pystemd/*.c
28 '';
29
30 buildInputs = [ systemd ];
31
32 build-system = [
33 setuptools
34 cython
35 ];
36
37 nativeBuildInputs = [
38 pkg-config
39 ];
40
41 propagatedBuildInputs = [
42 lxml
43 psutil
44 ];
45
46 nativeCheckInputs = [
47 mock
48 pytest
49 ];
50
51 checkPhase = ''
52 runHook preCheck
53 # pytestCheckHook doesn't work
54 pytest tests
55 runHook postCheck
56 '';
57
58 pythonImportsCheck = [ "pystemd" ];
59
60 meta = {
61 description = ''
62 Thin Cython-based wrapper on top of libsystemd, focused on exposing the
63 dbus API via sd-bus in an automated and easy to consume way
64 '';
65 homepage = "https://github.com/facebookincubator/pystemd/";
66 license = lib.licenses.lgpl21Plus;
67 maintainers = with lib.maintainers; [ flokli ];
68 };
69}