[GSoC] watcher prototype for MacOS

Nicolas Dumazet nicdumz at gmail.com
Thu Aug 13 06:01:14 CDT 2009

Hello -devel!

I have just pushed to [1] my work of the past days: I have implemented
a file system watcher prototype for Mac OS, which uses my pyfsevents
module [2].

In short, watcher.py is a program that watches a specific path and
prints on stdout the changes that happened. Its internal data
structure is very similar to the directory class in use in inotify for
Linux at the moment: by maintaining an internal representation of the
file hierarchy, and by registering callbacks for File System events,
it is able to determine what change exactly happen in the repertory.

Extending this script to a simple inotify server for Mac should be a
matter of a few days.

I've written an extensive test for that script: test.py generates
randomly a thousand file system events (create, modify or delete a
file or a directory) and verifies the output of watcher.py in this
context. The correctness of this test validates both the underlying
pyfsevents module, and the callback model for watching file system

[1] http://bitbucket.org/nicdumz/mac-inotify/
[2] http://bitbucket.org/nicdumz/fsevents/

Nicolas Dumazet — NicDumZ [ nɪk.d̪ymz ]

More information about the Mercurial-devel mailing list