1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 gitUpdater,
7
8 # build-system
9 setuptools,
10 setuptools-lint,
11 sphinx,
12
13 # dependencies
14 xlib,
15 evdev,
16 six,
17
18 # tests
19 unittestCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "pynput";
24 version = "1.8.1";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "moses-palmer";
29 repo = "pynput";
30 tag = "v${version}";
31 hash = "sha256-rOkUyreS3JqEyubQUdNLJf5lDuFassDKrQrUXKrKlgI=";
32 };
33 passthru.updateScript = gitUpdater {
34 rev-prefix = "v";
35 };
36
37 postPatch = ''
38 substituteInPlace setup.py \
39 --replace-fail "'sphinx >=1.3.1'," "" \
40 --replace-fail "'twine >=4.0']" "]"
41 '';
42
43 nativeBuildInputs = [
44 setuptools
45 setuptools-lint
46 sphinx
47 ];
48
49 propagatedBuildInputs =
50 [ six ]
51 ++ lib.optionals stdenv.hostPlatform.isLinux [
52 evdev
53 xlib
54 ];
55
56 doCheck = false; # requires running X server
57
58 nativeCheckInputs = [ unittestCheckHook ];
59
60 meta = with lib; {
61 broken = stdenv.hostPlatform.isDarwin;
62 description = "Library to control and monitor input devices";
63 homepage = "https://github.com/moses-palmer/pynput";
64 license = licenses.lgpl3;
65 maintainers = with maintainers; [ nickhu ];
66 };
67}