1{
2 lib,
3 fetchPypi,
4 buildPythonPackage,
5 six,
6 udev,
7 pytest,
8 mock,
9 hypothesis,
10 docutils,
11 stdenvNoCC,
12}:
13
14buildPythonPackage rec {
15 pname = "pyudev";
16 version = "0.24.3";
17 format = "setuptools";
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-LpRUJ6IWdIk7uXYyQB22ITnZHOoe6WE3zHsHrSIZj8c=";
22 };
23
24 postPatch = lib.optionalString stdenvNoCC.hostPlatform.isLinux ''
25 substituteInPlace src/pyudev/_ctypeslib/utils.py \
26 --replace "find_library(name)" "'${lib.getLib udev}/lib/libudev.so'"
27 '';
28
29 nativeCheckInputs = [
30 pytest
31 mock
32 hypothesis
33 docutils
34 ];
35 propagatedBuildInputs = [ six ];
36
37 checkPhase = ''
38 py.test
39 '';
40
41 # Bunch of failing tests
42 # https://github.com/pyudev/pyudev/issues/187
43 doCheck = false;
44
45 meta = with lib; {
46 homepage = "https://pyudev.readthedocs.org/";
47 description = "Pure Python libudev binding";
48 license = licenses.lgpl21Plus;
49 maintainers = with maintainers; [ frogamic ];
50 };
51}