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 darwin,
17 six,
18
19 # tests
20 unittestCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "pynput";
25 version = "1.7.7";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "moses-palmer";
30 repo = "pynput";
31 rev = "refs/tags/v${version}";
32 hash = "sha256-6PwfFU1f/osEamSX9kxpOl2wDnrQk5qq1kHi2BgSHes=";
33 };
34 passthru.updateScript = gitUpdater {
35 rev-prefix = "v";
36 };
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace-fail "'sphinx >=1.3.1'," "" \
41 --replace-fail "'twine >=4.0']" "]"
42 '';
43
44 nativeBuildInputs = [
45 setuptools
46 setuptools-lint
47 sphinx
48 ];
49
50 propagatedBuildInputs =
51 [ six ]
52 ++ lib.optionals stdenv.hostPlatform.isLinux [
53 evdev
54 xlib
55 ]
56 ++ lib.optionals stdenv.hostPlatform.isDarwin (
57 with darwin.apple_sdk.frameworks;
58 [
59 ApplicationServices
60 Quartz
61 ]
62 );
63
64 doCheck = false; # requires running X server
65
66 nativeCheckInputs = [ unittestCheckHook ];
67
68 meta = with lib; {
69 broken = stdenv.hostPlatform.isDarwin;
70 description = "Library to control and monitor input devices";
71 homepage = "https://github.com/moses-palmer/pynput";
72 license = licenses.lgpl3;
73 maintainers = with maintainers; [ nickhu ];
74 };
75}