1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 eventlet,
6 fetchPypi,
7 flaky,
8 pytest-cov-stub,
9 pytest-timeout,
10 pytestCheckHook,
11 pythonOlder,
12 pyyaml,
13 setuptools,
14}:
15
16buildPythonPackage rec {
17 pname = "watchdog";
18 version = "6.0.0";
19 pyproject = true;
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-nd98gv2jro4k3s2hM47eZuHJmIPbk3Edj7lB6qLYwoI=";
24 };
25
26 build-system = [ setuptools ];
27
28 optional-dependencies.watchmedo = [ pyyaml ];
29
30 nativeCheckInputs = [
31 flaky
32 pytest-cov-stub
33 pytest-timeout
34 pytestCheckHook
35 ]
36 ++ optional-dependencies.watchmedo
37 ++ lib.optionals (pythonOlder "3.13") [ eventlet ];
38
39 disabledTestPaths = [
40 "tests/test_emitter.py::test_create_wrong_encoding"
41 "tests/test_emitter.py::test_close"
42 # tests timeout easily
43 "tests/test_inotify_buffer.py"
44 # assert cap.out.splitlines(keepends=False).count('+++++ 0') == 2 != 3
45 "tests/test_0_watchmedo.py::test_auto_restart_on_file_change_debounce"
46 ]
47 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
48 # segfaults the testsuite
49 "tests/test_emitter.py"
50 # unsupported on x86_64-darwin
51 "tests/test_fsevents.py"
52 # fails to stop process in teardown
53 "tests/test_0_watchmedo.py::test_auto_restart_subprocess_termination"
54 ]
55 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
56 # FileCreationEvent != FileDeletionEvent
57 "tests/test_emitter.py::test_separate_consecutive_moves"
58 "tests/test_observers_polling.py::test___init__"
59 # segfaults
60 "tests/test_delayed_queue.py::test_delayed_get"
61 "tests/test_emitter.py::test_delete"
62 # AttributeError: '_thread.RLock' object has no attribute 'key'"
63 "tests/test_skip_repeats_queue.py::test_eventlet_monkey_patching"
64 ]
65 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
66 # segfaults
67 "tests/test_delayed_queue.py::test_delayed_get"
68 "tests/test_0_watchmedo.py::test_tricks_from_file"
69 "tests/test_fsevents.py::test_watcher_deletion_while_receiving_events_1"
70 "tests/test_fsevents.py::test_watcher_deletion_while_receiving_events_2"
71 "tests/test_skip_repeats_queue.py::test_eventlet_monkey_patching"
72 "tests/test_fsevents.py::test_recursive_check_accepts_relative_paths"
73 # fsevents:fsevents.py:318 Unhandled exception in FSEventsEmitter
74 "tests/test_fsevents.py::test_watchdog_recursive"
75 # SystemError: Cannot start fsevents stream. Use a kqueue or polling observer...
76 "tests/test_fsevents.py::test_add_watch_twice"
77 # gets stuck
78 "tests/test_fsevents.py::test_converting_cfstring_to_pyunicode"
79 ];
80
81 pythonImportsCheck = [ "watchdog" ];
82
83 meta = with lib; {
84 description = "Python API and shell utilities to monitor file system events";
85 mainProgram = "watchmedo";
86 homepage = "https://github.com/gorakhargosh/watchdog";
87 changelog = "https://github.com/gorakhargosh/watchdog/blob/v${version}/changelog.rst";
88 license = licenses.asl20;
89 maintainers = [ ];
90 };
91}