Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / watchdog / default.nix
blob9ac39683ba39f2df538f435bb16098107b1dd43b
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , CoreServices
5 , eventlet
6 , fetchpatch
7 , fetchPypi
8 , flaky
9 , pytest-timeout
10 , pytestCheckHook
11 , pythonOlder
12 , pyyaml
15 buildPythonPackage rec {
16   pname = "watchdog";
17   version = "4.0.0";
18   format = "setuptools";
20   disabled = pythonOlder "3.7";
22   src = fetchPypi {
23     inherit pname version;
24     hash = "sha256-4+cGXL2r5hg6uCGZ16T2s7oKQ4xaUSpoVZhGzLdqeOw=";
25   };
27   # force kqueue on x86_64-darwin, because our api version does
28   # not support fsevents
29   patches = lib.optionals (stdenv.isDarwin && !stdenv.isAarch64) [
30     ./force-kqueue.patch
31   ];
33   buildInputs = lib.optionals stdenv.isDarwin [
34     CoreServices
35   ];
37   passthru.optional-dependencies.watchmedo = [
38     pyyaml
39   ];
41   nativeCheckInputs = [
42     eventlet
43     flaky
44     pytest-timeout
45     pytestCheckHook
46   ] ++ passthru.optional-dependencies.watchmedo;
48   postPatch = ''
49     substituteInPlace setup.cfg \
50       --replace "--cov=watchdog" "" \
51       --replace "--cov-report=term-missing" ""
52   '';
54   pytestFlagsArray = [
55     "--deselect=tests/test_emitter.py::test_create_wrong_encoding"
56     "--deselect=tests/test_emitter.py::test_close"
57   ] ++ lib.optionals (stdenv.isDarwin) [
58     # fails to stop process in teardown
59     "--deselect=tests/test_0_watchmedo.py::test_auto_restart_subprocess_termination"
60     # assert cap.out.splitlines(keepends=False).count('+++++ 0') == 2 != 3
61     "--deselect=tests/test_0_watchmedo.py::test_auto_restart_on_file_change_debounce"
62   ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
63     # FileCreationEvent != FileDeletionEvent
64     "--deselect=tests/test_emitter.py::test_separate_consecutive_moves"
65     "--deselect=tests/test_observers_polling.py::test___init__"
66     # segfaults
67     "--deselect=tests/test_delayed_queue.py::test_delayed_get"
68     "--deselect=tests/test_emitter.py::test_delete"
69     # AttributeError: '_thread.RLock' object has no attribute 'key'"
70     "--deselect=tests/test_skip_repeats_queue.py::test_eventlet_monkey_patching"
71   ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
72     # segfaults
73     "--deselect=tests/test_delayed_queue.py::test_delayed_get"
74     "--deselect=tests/test_0_watchmedo.py::test_tricks_from_file"
75     "--deselect=tests/test_fsevents.py::test_watcher_deletion_while_receiving_events_1"
76     "--deselect=tests/test_fsevents.py::test_watcher_deletion_while_receiving_events_2"
77     "--deselect=tests/test_skip_repeats_queue.py::test_eventlet_monkey_patching"
78     "--deselect=tests/test_fsevents.py::test_recursive_check_accepts_relative_paths"
79     # fsevents:fsevents.py:318 Unhandled exception in FSEventsEmitter
80     "--deselect=tests/test_fsevents.py::test_watchdog_recursive"
81     # SystemError: Cannot start fsevents stream. Use a kqueue or polling observer...
82     "--deselect=tests/test_fsevents.py::test_add_watch_twice"
83     # fsevents:fsevents.py:318 Unhandled exception in FSEventsEmitter
84     "--deselect=ests/test_fsevents.py::test_recursive_check_accepts_relative_paths"
85     # gets stuck
86     "--deselect=tests/test_fsevents.py::test_converting_cfstring_to_pyunicode"
87   ];
89   disabledTestPaths = [
90     # tests timeout easily
91     "tests/test_inotify_buffer.py"
92   ] ++ lib.optionals (stdenv.isDarwin) [
93     # segfaults the testsuite
94     "tests/test_emitter.py"
95     # unsupported on x86_64-darwin
96     "tests/test_fsevents.py"
97   ];
99   pythonImportsCheck = [
100     "watchdog"
101   ];
103   meta = with lib; {
104     description = "Python API and shell utilities to monitor file system events";
105     mainProgram = "watchmedo";
106     homepage = "https://github.com/gorakhargosh/watchdog";
107     changelog = "https://github.com/gorakhargosh/watchdog/blob/v${version}/changelog.rst";
108     license = licenses.asl20;
109     maintainers = with maintainers; [ goibhniu ];
110   };