Skip to content

Commit

Permalink
[mac] Add compatibility with old macOS versions (#733)
Browse files Browse the repository at this point in the history
* Add compatibility with old macOS versions

* Define symbols only for older versions

And not for older or equal, since the equal version is when the symbol
was introduced.

* Ensure version macros are available

* Update changelog
  • Loading branch information
CCP-Aporia committed Dec 14, 2020
1 parent 44b9618 commit 1d7cb5d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion changelog.rst
Expand Up @@ -9,7 +9,8 @@ Changelog
202x-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v1.0.1...master>`__

- [mac] Fix missing ``event_id`` attribute in ``fsevents`` (`#721 <https://github.com/gorakhargosh/watchdog/pull/721>`_)
- Thanks to our beloved contributors: @SamSchott
- [mac] Add compatibility with old macOS versions (`#733` <https://github.com/gorakhargosh/watchdog/pull/733>`_)
- Thanks to our beloved contributors: @SamSchott, @CCP-Aporia


1.0.1
Expand Down
26 changes: 26 additions & 0 deletions src/watchdog_fsevents.c
Expand Up @@ -20,12 +20,38 @@


#include <Python.h>
#include <Availability.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <stdlib.h>
#include <signal.h>


/* Compatibility; since fsevents won't set these on earlier macOS versions the properties will always be False */
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
#error Watchdog module requires at least Mac OS X 10.7
#endif
#ifndef MAC_OS_X_VERSION_10_9
#define MAC_OS_X_VERSION_10_9 1090
#endif
#ifndef MAC_OS_X_VERSION_10_10
#define MAC_OS_X_VERSION_10_10 101000
#endif
#ifndef MAC_OS_X_VERSION_10_13
#define MAC_OS_X_VERSION_10_13 101300
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
#define kFSEventStreamEventFlagOwnEvent 0x00080000
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
#define kFSEventStreamEventFlagItemIsHardlink 0x00100000
#define kFSEventStreamEventFlagItemIsLastHardlink 0x00200000
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13
#define kFSEventStreamEventFlagItemCloned 0x00400000
#endif


/* Convenience macros to make code more readable. */
#define G_NOT(o) !o
#define G_IS_NULL(o) o == NULL
Expand Down

0 comments on commit 1d7cb5d

Please sign in to comment.