From acea996e0081cfa323056c6195729b6a749c41c5 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Tue, 17 May 2022 23:16:52 +0100 Subject: [PATCH] support notify 5.0.0-pre.15 (#146) * support notify 5.0.0-pre.15, fix #144 * pin to exact notify pre-release Co-authored-by: Pavan Kumar Sunkara Co-authored-by: Pavan Kumar Sunkara --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/lib.rs | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7e373e92..44e023da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "notify" -version = "5.0.0-pre.14" +version = "5.0.0-pre.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d13c22db70a63592e098fb51735bab36646821e6389a0ba171f3549facdf0b74" +checksum = "553f9844ad0b0824605c20fb55a661679782680410abfb1a8144c2e7e437e7a7" dependencies = [ "bitflags", "crossbeam-channel", diff --git a/Cargo.toml b/Cargo.toml index 43f4e35d..afb4d7b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] crossbeam-channel = "0.5.4" -notify = "5.0.0-pre.14" +notify = "=5.0.0-pre.15" pyo3 = {version = "0.16.4", features = ["extension-module"]} [lib] diff --git a/src/lib.rs b/src/lib.rs index 6d328441..fac8343c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ use pyo3::exceptions::{PyFileNotFoundError, PyRuntimeError, PyTypeError}; use pyo3::prelude::*; use notify::event::{Event, EventKind, ModifyKind, RenameMode}; +use notify::poll::PollWatcherConfig; use notify::{PollWatcher, RecommendedWatcher, RecursiveMode, Result as NotifyResult, Watcher}; create_exception!( @@ -125,7 +126,11 @@ impl RustNotify { let watcher: WatcherEnum = match force_polling { true => { let delay = Duration::from_millis(poll_delay_ms); - let mut watcher = PollWatcher::with_delay(event_handler, delay).map_err(py_error)?; + let config = PollWatcherConfig { + poll_interval: delay, + compare_contents: false, + }; + let mut watcher = PollWatcher::with_config(event_handler, config).map_err(py_error)?; watcher_paths!(watcher, watch_paths, debug); WatcherEnum::Poll(watcher) }