1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pathtools
6, pyyaml
7, flaky
8, pytest-timeout
9, pytestCheckHook
10, CoreServices
11, fetchpatch
12}:
13
14buildPythonPackage rec {
15 pname = "watchdog";
16 version = "2.1.9";
17 format = "setuptools";
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "sha256-Q84g67NqUfIfo3b3bR1GkkUrJSfM1gGVDWntNrniFgk=";
22 };
23
24 patches = lib.optionals (stdenv.isDarwin && !stdenv.isAarch64) [
25 ./force-kqueue.patch
26 ] ++ [
27 (fetchpatch {
28 url = "https://github.com/gorakhargosh/watchdog/commit/255d1e45c17929dd5ba8a6f91aa28771109931cd.patch";
29 sha256 = "sha256-gGgEGuB/0g+4Pv1dXMvIdObjqKruWKkxtufS/dzSlY8=";
30 excludes = [ "changelog.rst" ];
31 })
32 ];
33
34 buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
35
36 propagatedBuildInputs = [
37 pathtools
38 pyyaml
39 ];
40
41 checkInputs = [
42 flaky
43 pytest-timeout
44 pytestCheckHook
45 ];
46
47 postPatch = ''
48 substituteInPlace setup.cfg \
49 --replace "--cov=watchdog" "" \
50 --replace "--cov-report=term-missing" ""
51 '';
52
53 disabledTests = [
54 # probably failing because of an encoding related issue
55 "test_create_wrong_encoding"
56 ] ++ lib.optionals (stdenv.isDarwin && !stdenv.isAarch64) [
57 "test_delete"
58 "test_separate_consecutive_moves"
59 ];
60
61 disabledTestPaths = [
62 # Tests are flaky
63 "tests/test_inotify_buffer.py"
64 ];
65
66 pythonImportsCheck = [
67 "watchdog"
68 ];
69
70 meta = with lib; {
71 description = "Python API and shell utilities to monitor file system events";
72 homepage = "https://github.com/gorakhargosh/watchdog";
73 license = licenses.asl20;
74 maintainers = with maintainers; [ goibhniu ];
75 };
76}