lol

python310Packages.watchdog: 2.3.1 -> 3.0.0

https://github.com/gorakhargosh/watchdog/blob/v3.0.0/changelog.rst

+24 -153
+7 -3
pkgs/development/python-modules/watchdog/default.nix
··· 14 14 15 15 buildPythonPackage rec { 16 16 pname = "watchdog"; 17 - version = "2.3.1"; 17 + version = "3.0.0"; 18 18 format = "setuptools"; 19 19 20 20 disabled = pythonOlder "3.7"; 21 21 22 22 src = fetchPypi { 23 23 inherit pname version; 24 - hash = "sha256-2fntJu0iqdMxggqEMsNoBwfqi1QSHdzJ3H2fLO6zaQY="; 24 + hash = "sha256-TZijIFldp6fFoY/EjLYzwuc82nj5PKwu9C1Cv2CaM/k="; 25 25 }; 26 26 27 + # force kqueue on x86_64-darwin, because our api version does 28 + # not support fsevents 27 29 patches = lib.optionals (stdenv.isDarwin && !stdenv.isAarch64) [ 28 30 ./force-kqueue.patch 29 31 ]; ··· 60 62 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ 61 63 # FileCreationEvent != FileDeletionEvent 62 64 "--deselect=tests/test_emitter.py::test_separate_consecutive_moves" 65 + "--deselect=tests/test_observers_polling.py::test___init__" 63 66 # segfaults 64 67 "--deselect=tests/test_delayed_queue.py::test_delayed_get" 65 68 "--deselect=tests/test_emitter.py::test_delete" ··· 86 89 disabledTestPaths = [ 87 90 # tests timeout easily 88 91 "tests/test_inotify_buffer.py" 89 - ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 92 + ] ++ lib.optionals (stdenv.isDarwin) [ 90 93 # segfaults the testsuite 91 94 "tests/test_emitter.py" 95 + # unsupported on x86_64-darwin 92 96 "tests/test_fsevents.py" 93 97 ]; 94 98
+17 -150
pkgs/development/python-modules/watchdog/force-kqueue.patch
··· 1 1 diff --git a/setup.py b/setup.py 2 - index 072dfc8..64732bb 100644 2 + index 337e4be..55ef9a6 100644 3 3 --- a/setup.py 4 4 +++ b/setup.py 5 - @@ -39,7 +39,7 @@ _apple_devices = ('appletv', 'iphone', 'ipod', 'ipad', 'watch') 6 - is_macos = sys.platform == 'darwin' and not machine().lower().startswith(_apple_devices) 5 + @@ -38,7 +38,7 @@ _apple_devices = ("appletv", "iphone", "ipod", "ipad", "watch") 6 + is_macos = sys.platform == "darwin" and not machine().lower().startswith(_apple_devices) 7 7 8 8 ext_modules = [] 9 - -if is_macos or os.getenv('FORCE_MACOS_MACHINE', '0') == '1': 9 + -if is_macos or os.getenv("FORCE_MACOS_MACHINE", "0") == "1": 10 10 +if False: 11 11 ext_modules = [ 12 12 Extension( 13 - name='_watchdog_fsevents', 14 - diff --git a/tests/test_emitter.py b/tests/test_emitter.py 15 - index bec052c..242fbea 100644 16 - --- a/tests/test_emitter.py 17 - +++ b/tests/test_emitter.py 18 - @@ -42,13 +42,11 @@ if platform.is_linux(): 19 - InotifyEmitter as Emitter, 20 - InotifyFullEmitter, 21 - ) 22 - -elif platform.is_darwin(): 13 + name="_watchdog_fsevents", 14 + diff --git a/tests/utils.py b/tests/utils.py 15 + index 00dcf40..9fbc42a 100644 16 + --- a/tests/utils.py 17 + +++ b/tests/utils.py 18 + @@ -15,8 +15,6 @@ Emitter: Type[EventEmitter] 19 + if sys.platform.startswith("linux"): 20 + from watchdog.observers.inotify import InotifyEmitter as Emitter 21 + from watchdog.observers.inotify import InotifyFullEmitter 22 + -elif sys.platform.startswith("darwin"): 23 23 - from watchdog.observers.fsevents import FSEventsEmitter as Emitter 24 - elif platform.is_windows(): 25 - from watchdog.observers.read_directory_changes import ( 26 - WindowsApiEmitter as Emitter 27 - ) 28 - -elif platform.is_bsd(): 29 - +elif platform.is_bsd() or platform.is_darwin(): 30 - from watchdog.observers.kqueue import ( 31 - KqueueEmitter as Emitter 32 - ) 33 - @@ -57,12 +55,6 @@ logging.basicConfig(level=logging.DEBUG) 34 - logger = logging.getLogger(__name__) 35 - 36 - 37 - -if platform.is_darwin(): 38 - - # enable more verbose logs 39 - - fsevents_logger = logging.getLogger("fsevents") 40 - - fsevents_logger.setLevel(logging.DEBUG) 41 - - 42 - - 43 - @pytest.fixture(autouse=True) 44 - def setup_teardown(tmpdir): 45 - global p, emitter, event_queue 46 - @@ -85,9 +77,6 @@ def start_watching(path=None, use_full_emitter=False, recursive=True): 47 - else: 48 - emitter = Emitter(event_queue, ObservedWatch(path, recursive=recursive)) 49 - 50 - - if platform.is_darwin(): 51 - - emitter.suppress_history = True 52 - - 53 - emitter.start() 54 - 55 - 56 - @@ -345,7 +334,7 @@ def test_separate_consecutive_moves(): 57 - if platform.is_windows(): 58 - expected_events = [a_deleted, d_created] 59 - 60 - - if platform.is_bsd(): 61 - + if platform.is_bsd() or platform.is_darwin(): 62 - # Due to the way kqueue works, we can't really order 63 - # 'Created' and 'Deleted' events in time, so creation queues first 64 - expected_events = [d_created, a_deleted, dir_modif, dir_modif] 65 - @@ -355,7 +344,7 @@ def test_separate_consecutive_moves(): 66 - 67 - 68 - @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter) 69 - -@pytest.mark.skipif(platform.is_bsd(), reason="BSD create another set of events for this test") 70 - +@pytest.mark.skipif(platform.is_bsd() or platform.is_darwin(), reason="BSD create another set of events for this test") 71 - def test_delete_self(): 72 - mkdir(p('dir1')) 73 - start_watching(p('dir1')) 74 - @@ -365,7 +354,7 @@ def test_delete_self(): 75 - assert not emitter.is_alive() 76 - 77 - 78 - -@pytest.mark.skipif(platform.is_windows() or platform.is_bsd(), 79 - +@pytest.mark.skipif(platform.is_windows() or platform.is_bsd() or platform.is_darwin(), 80 - reason="Windows|BSD create another set of events for this test") 81 - def test_fast_subdirectory_creation_deletion(): 82 - root_dir = p('dir1') 83 - @@ -429,7 +418,7 @@ def test_recursive_on(): 84 - assert event.src_path == p('dir1', 'dir2', 'dir3') 85 - assert isinstance(event, DirModifiedEvent) 86 - 87 - - if not platform.is_bsd(): 88 - + if not (platform.is_bsd() or platform.is_darwin()): 89 - event = event_queue.get(timeout=5)[0] 90 - assert event.src_path == p('dir1', 'dir2', 'dir3', 'a') 91 - assert isinstance(event, FileModifiedEvent) 92 - @@ -452,26 +441,6 @@ def test_recursive_off(): 93 - if platform.is_linux(): 94 - expect_event(FileClosedEvent(p('b'))) 95 - 96 - - # currently limiting these additional events to macOS only, see https://github.com/gorakhargosh/watchdog/pull/779 97 - - if platform.is_darwin(): 98 - - mkdir(p('dir1', 'dir2')) 99 - - with pytest.raises(Empty): 100 - - event_queue.get(timeout=5) 101 - - mkfile(p('dir1', 'dir2', 'somefile')) 102 - - with pytest.raises(Empty): 103 - - event_queue.get(timeout=5) 104 - - 105 - - mkdir(p('dir3')) 106 - - expect_event(DirModifiedEvent(p())) # the contents of the parent directory changed 107 - - 108 - - mv(p('dir1', 'dir2', 'somefile'), p('somefile')) 109 - - expect_event(FileMovedEvent(p('dir1', 'dir2', 'somefile'), p('somefile'))) 110 - - expect_event(DirModifiedEvent(p())) 111 - - 112 - - mv(p('dir1', 'dir2'), p('dir2')) 113 - - expect_event(DirMovedEvent(p('dir1', 'dir2'), p('dir2'))) 114 - - expect_event(DirModifiedEvent(p())) 115 - - 116 - 117 - @pytest.mark.skipif(platform.is_windows(), 118 - reason="Windows create another set of events for this test") 119 - @@ -493,7 +462,7 @@ def test_renaming_top_level_directory(): 120 - 121 - expect_event(DirMovedEvent(p('a', 'b'), p('a2', 'b'))) 122 - 123 - - if platform.is_bsd(): 124 - + if platform.is_bsd() or platform.is_darwin(): 125 - expect_event(DirModifiedEvent(p())) 126 - 127 - open(p('a2', 'b', 'c'), 'a').close() 128 - @@ -584,7 +553,7 @@ def test_move_nested_subdirectories(): 129 - expect_event(DirMovedEvent(p('dir1', 'dir2', 'dir3'), p('dir2', 'dir3'))) 130 - expect_event(FileMovedEvent(p('dir1', 'dir2', 'dir3', 'a'), p('dir2', 'dir3', 'a'))) 131 - 132 - - if platform.is_bsd(): 133 - + if platform.is_bsd() or platform.is_darwin(): 134 - event = event_queue.get(timeout=5)[0] 135 - assert p(event.src_path) == p() 136 - assert isinstance(event, DirModifiedEvent) 137 - @@ -643,7 +612,7 @@ def test_move_nested_subdirectories_on_windows(): 138 - 139 - 140 - @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter) 141 - -@pytest.mark.skipif(platform.is_bsd(), reason="BSD create another set of events for this test") 142 - +@pytest.mark.skipif(platform.is_bsd() or platform.is_darwin(), reason="BSD create another set of events for this test") 143 - def test_file_lifecyle(): 144 - start_watching() 145 - 146 - diff --git a/tests/test_fsevents.py b/tests/test_fsevents.py 147 - index 4a4fabf..49886a1 100644 148 - --- a/tests/test_fsevents.py 149 - +++ b/tests/test_fsevents.py 150 - @@ -3,8 +3,7 @@ 151 - import pytest 152 - from watchdog.utils import platform 153 - 154 - -if not platform.is_darwin(): # noqa 155 - - pytest.skip("macOS only.", allow_module_level=True) 156 - +pytest.skip("doesn't work with Nix yet", allow_module_level=True) 157 - 158 - import logging 159 - import os 24 + elif sys.platform.startswith("win"): 25 + from watchdog.observers.read_directory_changes import WindowsApiEmitter as Emitter 26 + elif sys.platform.startswith(("dragonfly", "freebsd", "netbsd", "openbsd", "bsd")):