gorakhargosh/watchdog — pull request #204 by wbond (2014-01-01 08:59:34+00:00)
Title: Fsevents Python 3 Compatibility

Recently I've started using OS X for more development work and ran into the fsevents observer not working with Python 3.

This patch set fixes two things:

1. The first commit fixes a but where 2to3 was being run by setup.py, which was breaking the `unicode_paths.py` code by converting `unicode` to `str` where it should be left alone. On my OS X machine, I've successfully installed and run the tests with both Python 2.7 and 3.3 with `use_2to3` set to `False`.

2. I've updated the watchdog_fsevents C code to work with both Python 2 and 3 by adding preprocessor directives to use the new Capsules C API for Python 3. I also improved the code to handle paths as both Python 3 `str` and `bytes` objects, giving greater flexibility so that path matches don't need to be converted to `bytes` if the original path is a `str`.

This should fix #122 and part of #202.