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 ]
52 ++ lib.optionals stdenv.hostPlatform.isLinux [
53 evdev
54 xlib
55 ];
56
57 doCheck = false; # requires running X server
58
59 nativeCheckInputs = [ unittestCheckHook ];
60
61 meta = with lib; {
62 broken = stdenv.hostPlatform.isDarwin;
63 description = "Library to control and monitor input devices";
64 homepage = "https://github.com/moses-palmer/pynput";
65 license = licenses.lgpl3;
66 maintainers = with maintainers; [ nickhu ];
67 };
68}