Commit ac96953d authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Fix compatibility with Pyinotify 0.8



I didn't know why the code previously used
“pyinotify.EventsCodes.ALL_FLAGS” instead of using the flags from
“pyinotify.EventsCodes” directly. Turns out that Pyinotify 0.8 has them
in “pyinotify”, not “pyinotify.EventsCodes”.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 073c31a5
......@@ -253,11 +253,12 @@ class FileEventHandler(asyncnotifier.FileEventHandlerBase):
self._cb = cb
self._filename = os.path.basename(path)
# Class '...' has no 'IN_...' member, pylint: disable-msg=E1103
mask = (pyinotify.EventsCodes.IN_CLOSE_WRITE |
pyinotify.EventsCodes.IN_DELETE |
pyinotify.EventsCodes.IN_MOVED_FROM |
pyinotify.EventsCodes.IN_MOVED_TO)
# Different Pyinotify versions have the flag constants at different places,
# hence not accessing them directly
mask = (pyinotify.EventsCodes.ALL_FLAGS["IN_CLOSE_WRITE"] |
pyinotify.EventsCodes.ALL_FLAGS["IN_DELETE"] |
pyinotify.EventsCodes.ALL_FLAGS["IN_MOVED_FROM"] |
pyinotify.EventsCodes.ALL_FLAGS["IN_MOVED_TO"])
self._handle = self.AddWatch(os.path.dirname(path), mask)
......
......@@ -153,9 +153,10 @@ class SingleFileEventHandler(FileEventHandlerBase):
if self._watch_handle is not None:
return
# Class '...' has no 'IN_...' member, pylint: disable-msg=E1103
mask = (pyinotify.EventsCodes.IN_MODIFY |
pyinotify.EventsCodes.IN_IGNORED)
# Different Pyinotify versions have the flag constants at different places,
# hence not accessing them directly
mask = (pyinotify.EventsCodes.ALL_FLAGS["IN_MODIFY"] |
pyinotify.EventsCodes.ALL_FLAGS["IN_IGNORED"])
self._watch_handle = self.AddWatch(self._filename, mask)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment