diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
commit | 99fcaeccb89621dd492203ce1f2d551c06f228ed (patch) | |
tree | 41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/development/python-modules/watchdog | |
parent | 59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff) | |
parent | 75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff) | |
download | nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2 nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/nixos/modules/config/console.nix nixpkgs/nixos/modules/services/mail/mailman.nix nixpkgs/nixos/modules/services/mail/public-inbox.nix nixpkgs/nixos/modules/services/mail/rss2email.nix nixpkgs/nixos/modules/services/networking/ssh/sshd.nix nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix nixpkgs/pkgs/applications/networking/irc/weechat/default.nix nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/go/module.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/interpreters/python/default.nix nixpkgs/pkgs/development/node-packages/overrides.nix nixpkgs/pkgs/development/tools/b4/default.nix nixpkgs/pkgs/servers/dict/dictd-db.nix nixpkgs/pkgs/servers/mail/public-inbox/default.nix nixpkgs/pkgs/tools/security/pinentry/default.nix nixpkgs/pkgs/tools/text/unoconv/default.nix nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/watchdog')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/watchdog/default.nix | 74 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/watchdog/force-kqueue.patch | 167 |
2 files changed, 75 insertions, 166 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/watchdog/default.nix b/nixpkgs/pkgs/development/python-modules/watchdog/default.nix index c530ea66cde6..4e4f491e23ae 100644 --- a/nixpkgs/pkgs/development/python-modules/watchdog/default.nix +++ b/nixpkgs/pkgs/development/python-modules/watchdog/default.nix @@ -1,41 +1,49 @@ { lib , stdenv , buildPythonPackage +, CoreServices +, eventlet +, fetchpatch , fetchPypi -, pathtools -, pyyaml , flaky , pytest-timeout , pytestCheckHook -, CoreServices +, pythonOlder +, pyyaml }: buildPythonPackage rec { pname = "watchdog"; - version = "2.1.9"; + version = "3.0.0"; format = "setuptools"; + disabled = pythonOlder "3.7"; + src = fetchPypi { inherit pname version; - sha256 = "sha256-Q84g67NqUfIfo3b3bR1GkkUrJSfM1gGVDWntNrniFgk="; + hash = "sha256-TZijIFldp6fFoY/EjLYzwuc82nj5PKwu9C1Cv2CaM/k="; }; + # force kqueue on x86_64-darwin, because our api version does + # not support fsevents patches = lib.optionals (stdenv.isDarwin && !stdenv.isAarch64) [ ./force-kqueue.patch ]; - buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ]; + buildInputs = lib.optionals stdenv.isDarwin [ + CoreServices + ]; - propagatedBuildInputs = [ - pathtools + passthru.optional-dependencies.watchmedo = [ pyyaml ]; - checkInputs = [ + nativeCheckInputs = [ + eventlet flaky pytest-timeout pytestCheckHook - ]; + ] ++ passthru.optional-dependencies.watchmedo; postPatch = '' substituteInPlace setup.cfg \ @@ -43,16 +51,49 @@ buildPythonPackage rec { --replace "--cov-report=term-missing" "" ''; - disabledTests = [ - # probably failing because of an encoding related issue - "test_create_wrong_encoding" - ] ++ lib.optionals (stdenv.isDarwin && !stdenv.isAarch64) [ - "test_delete" + pytestFlagsArray = [ + "--deselect=tests/test_emitter.py::test_create_wrong_encoding" + "--deselect=tests/test_emitter.py::test_close" + ] ++ lib.optionals (stdenv.isDarwin) [ + # fails to stop process in teardown + "--deselect=tests/test_0_watchmedo.py::test_auto_restart_subprocess_termination" + # assert cap.out.splitlines(keepends=False).count('+++++ 0') == 2 != 3 + "--deselect=tests/test_0_watchmedo.py::test_auto_restart_on_file_change_debounce" + ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ + # FileCreationEvent != FileDeletionEvent + "--deselect=tests/test_emitter.py::test_separate_consecutive_moves" + "--deselect=tests/test_observers_polling.py::test___init__" + # segfaults + "--deselect=tests/test_delayed_queue.py::test_delayed_get" + "--deselect=tests/test_emitter.py::test_delete" + # AttributeError: '_thread.RLock' object has no attribute 'key'" + "--deselect=tests/test_skip_repeats_queue.py::test_eventlet_monkey_patching" + ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ + # segfaults + "--deselect=tests/test_delayed_queue.py::test_delayed_get" + "--deselect=tests/test_0_watchmedo.py::test_tricks_from_file" + "--deselect=tests/test_fsevents.py::test_watcher_deletion_while_receiving_events_1" + "--deselect=tests/test_fsevents.py::test_watcher_deletion_while_receiving_events_2" + "--deselect=tests/test_skip_repeats_queue.py::test_eventlet_monkey_patching" + "--deselect=tests/test_fsevents.py::test_recursive_check_accepts_relative_paths" + # fsevents:fsevents.py:318 Unhandled exception in FSEventsEmitter + "--deselect=tests/test_fsevents.py::test_watchdog_recursive" + # SystemError: Cannot start fsevents stream. Use a kqueue or polling observer... + "--deselect=tests/test_fsevents.py::test_add_watch_twice" + # fsevents:fsevents.py:318 Unhandled exception in FSEventsEmitter + "--deselect=ests/test_fsevents.py::test_recursive_check_accepts_relative_paths" + # gets stuck + "--deselect=tests/test_fsevents.py::test_converting_cfstring_to_pyunicode" ]; disabledTestPaths = [ - # Tests are flaky + # tests timeout easily "tests/test_inotify_buffer.py" + ] ++ lib.optionals (stdenv.isDarwin) [ + # segfaults the testsuite + "tests/test_emitter.py" + # unsupported on x86_64-darwin + "tests/test_fsevents.py" ]; pythonImportsCheck = [ @@ -62,6 +103,7 @@ buildPythonPackage rec { meta = with lib; { description = "Python API and shell utilities to monitor file system events"; homepage = "https://github.com/gorakhargosh/watchdog"; + changelog = "https://github.com/gorakhargosh/watchdog/blob/v${version}/changelog.rst"; license = licenses.asl20; maintainers = with maintainers; [ goibhniu ]; }; diff --git a/nixpkgs/pkgs/development/python-modules/watchdog/force-kqueue.patch b/nixpkgs/pkgs/development/python-modules/watchdog/force-kqueue.patch index de222d891214..d4a0f4e6a00e 100644 --- a/nixpkgs/pkgs/development/python-modules/watchdog/force-kqueue.patch +++ b/nixpkgs/pkgs/development/python-modules/watchdog/force-kqueue.patch @@ -1,159 +1,26 @@ diff --git a/setup.py b/setup.py -index 072dfc8..64732bb 100644 +index 337e4be..55ef9a6 100644 --- a/setup.py +++ b/setup.py -@@ -39,7 +39,7 @@ _apple_devices = ('appletv', 'iphone', 'ipod', 'ipad', 'watch') - is_macos = sys.platform == 'darwin' and not machine().lower().startswith(_apple_devices) +@@ -38,7 +38,7 @@ _apple_devices = ("appletv", "iphone", "ipod", "ipad", "watch") + is_macos = sys.platform == "darwin" and not machine().lower().startswith(_apple_devices) ext_modules = [] --if is_macos or os.getenv('FORCE_MACOS_MACHINE', '0') == '1': +-if is_macos or os.getenv("FORCE_MACOS_MACHINE", "0") == "1": +if False: ext_modules = [ Extension( - name='_watchdog_fsevents', -diff --git a/tests/test_emitter.py b/tests/test_emitter.py -index bec052c..242fbea 100644 ---- a/tests/test_emitter.py -+++ b/tests/test_emitter.py -@@ -42,13 +42,11 @@ if platform.is_linux(): - InotifyEmitter as Emitter, - InotifyFullEmitter, - ) --elif platform.is_darwin(): + name="_watchdog_fsevents", +diff --git a/tests/utils.py b/tests/utils.py +index 00dcf40..9fbc42a 100644 +--- a/tests/utils.py ++++ b/tests/utils.py +@@ -15,8 +15,6 @@ Emitter: Type[EventEmitter] + if sys.platform.startswith("linux"): + from watchdog.observers.inotify import InotifyEmitter as Emitter + from watchdog.observers.inotify import InotifyFullEmitter +-elif sys.platform.startswith("darwin"): - from watchdog.observers.fsevents import FSEventsEmitter as Emitter - elif platform.is_windows(): - from watchdog.observers.read_directory_changes import ( - WindowsApiEmitter as Emitter - ) --elif platform.is_bsd(): -+elif platform.is_bsd() or platform.is_darwin(): - from watchdog.observers.kqueue import ( - KqueueEmitter as Emitter - ) -@@ -57,12 +55,6 @@ logging.basicConfig(level=logging.DEBUG) - logger = logging.getLogger(__name__) - - --if platform.is_darwin(): -- # enable more verbose logs -- fsevents_logger = logging.getLogger("fsevents") -- fsevents_logger.setLevel(logging.DEBUG) -- -- - @pytest.fixture(autouse=True) - def setup_teardown(tmpdir): - global p, emitter, event_queue -@@ -85,9 +77,6 @@ def start_watching(path=None, use_full_emitter=False, recursive=True): - else: - emitter = Emitter(event_queue, ObservedWatch(path, recursive=recursive)) - -- if platform.is_darwin(): -- emitter.suppress_history = True -- - emitter.start() - - -@@ -345,7 +334,7 @@ def test_separate_consecutive_moves(): - if platform.is_windows(): - expected_events = [a_deleted, d_created] - -- if platform.is_bsd(): -+ if platform.is_bsd() or platform.is_darwin(): - # Due to the way kqueue works, we can't really order - # 'Created' and 'Deleted' events in time, so creation queues first - expected_events = [d_created, a_deleted, dir_modif, dir_modif] -@@ -355,7 +344,7 @@ def test_separate_consecutive_moves(): - - - @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter) --@pytest.mark.skipif(platform.is_bsd(), reason="BSD create another set of events for this test") -+@pytest.mark.skipif(platform.is_bsd() or platform.is_darwin(), reason="BSD create another set of events for this test") - def test_delete_self(): - mkdir(p('dir1')) - start_watching(p('dir1')) -@@ -365,7 +354,7 @@ def test_delete_self(): - assert not emitter.is_alive() - - --@pytest.mark.skipif(platform.is_windows() or platform.is_bsd(), -+@pytest.mark.skipif(platform.is_windows() or platform.is_bsd() or platform.is_darwin(), - reason="Windows|BSD create another set of events for this test") - def test_fast_subdirectory_creation_deletion(): - root_dir = p('dir1') -@@ -429,7 +418,7 @@ def test_recursive_on(): - assert event.src_path == p('dir1', 'dir2', 'dir3') - assert isinstance(event, DirModifiedEvent) - -- if not platform.is_bsd(): -+ if not (platform.is_bsd() or platform.is_darwin()): - event = event_queue.get(timeout=5)[0] - assert event.src_path == p('dir1', 'dir2', 'dir3', 'a') - assert isinstance(event, FileModifiedEvent) -@@ -452,26 +441,6 @@ def test_recursive_off(): - if platform.is_linux(): - expect_event(FileClosedEvent(p('b'))) - -- # currently limiting these additional events to macOS only, see https://github.com/gorakhargosh/watchdog/pull/779 -- if platform.is_darwin(): -- mkdir(p('dir1', 'dir2')) -- with pytest.raises(Empty): -- event_queue.get(timeout=5) -- mkfile(p('dir1', 'dir2', 'somefile')) -- with pytest.raises(Empty): -- event_queue.get(timeout=5) -- -- mkdir(p('dir3')) -- expect_event(DirModifiedEvent(p())) # the contents of the parent directory changed -- -- mv(p('dir1', 'dir2', 'somefile'), p('somefile')) -- expect_event(FileMovedEvent(p('dir1', 'dir2', 'somefile'), p('somefile'))) -- expect_event(DirModifiedEvent(p())) -- -- mv(p('dir1', 'dir2'), p('dir2')) -- expect_event(DirMovedEvent(p('dir1', 'dir2'), p('dir2'))) -- expect_event(DirModifiedEvent(p())) -- - - @pytest.mark.skipif(platform.is_windows(), - reason="Windows create another set of events for this test") -@@ -493,7 +462,7 @@ def test_renaming_top_level_directory(): - - expect_event(DirMovedEvent(p('a', 'b'), p('a2', 'b'))) - -- if platform.is_bsd(): -+ if platform.is_bsd() or platform.is_darwin(): - expect_event(DirModifiedEvent(p())) - - open(p('a2', 'b', 'c'), 'a').close() -@@ -584,7 +553,7 @@ def test_move_nested_subdirectories(): - expect_event(DirMovedEvent(p('dir1', 'dir2', 'dir3'), p('dir2', 'dir3'))) - expect_event(FileMovedEvent(p('dir1', 'dir2', 'dir3', 'a'), p('dir2', 'dir3', 'a'))) - -- if platform.is_bsd(): -+ if platform.is_bsd() or platform.is_darwin(): - event = event_queue.get(timeout=5)[0] - assert p(event.src_path) == p() - assert isinstance(event, DirModifiedEvent) -@@ -643,7 +612,7 @@ def test_move_nested_subdirectories_on_windows(): - - - @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter) --@pytest.mark.skipif(platform.is_bsd(), reason="BSD create another set of events for this test") -+@pytest.mark.skipif(platform.is_bsd() or platform.is_darwin(), reason="BSD create another set of events for this test") - def test_file_lifecyle(): - start_watching() - -diff --git a/tests/test_fsevents.py b/tests/test_fsevents.py -index 4a4fabf..49886a1 100644 ---- a/tests/test_fsevents.py -+++ b/tests/test_fsevents.py -@@ -3,8 +3,7 @@ - import pytest - from watchdog.utils import platform - --if not platform.is_darwin(): # noqa -- pytest.skip("macOS only.", allow_module_level=True) -+pytest.skip("doesn't work with Nix yet", allow_module_level=True) - - import logging - import os + elif sys.platform.startswith("win"): + from watchdog.observers.read_directory_changes import WindowsApiEmitter as Emitter + elif sys.platform.startswith(("dragonfly", "freebsd", "netbsd", "openbsd", "bsd")): |