Skip to content

Commit

Permalink
[mac] Prevent compilation of watchdog_fsevents.c on non-macOS machines
Browse files Browse the repository at this point in the history
  • Loading branch information
BoboTiG committed Oct 28, 2020
1 parent d35ef6b commit 14a9406
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Changelog
- Replace mutable default arguments with ``if None`` implementation (`#677 <https://github.com/gorakhargosh/watchdog/pull/677>`_)
- Expand tests to Python 2.7 and 3.5-3.10 for GNU/Linux, macOS and Windows
- [mac] Performance improvements for the `fsevents` module (`#680 <https://github.com/gorakhargosh/watchdog/pull/680>`_)
- [mac] Prevent compilation of ``watchdog_fsevents.c`` on non-macOS machines (`#687 <https://github.com/gorakhargosh/watchdog/pull/687>`_)
- Handle shutdown events from SIGTERM and SIGINT to `watchmedo` more reliably (`#693 <https://github.com/gorakhargosh/watchdog/pull/693>`_)
- Thanks to our beloved contributors: @Sraw, @CCP-Aporia, @BoboTiG, @maybe-sybr

Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
# limitations under the License.

import sys
import os
import os.path
from codecs import open
from platform import machine
from setuptools import setup, find_packages
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext
Expand All @@ -36,8 +38,13 @@
import imp
version = imp.load_source('version', os.path.join(WATCHDOG_PKG_DIR, 'version.py'))

# Ignored Apple devices on which compiling watchdog_fsevents.c would fail.
# The FORCE_MACOS_MACHINE envar, when set to 1, will force the compilation.
_apple_devices = ('appletv', 'iphone', 'ipod', 'ipad', 'watch')
is_macos = sys.platform == 'darwin' and not machine().lower().startswith(_apple_devices)

ext_modules = []
if sys.platform == 'darwin':
if is_macos or os.getenv('FORCE_MACOS_MACHINE', '0') == '1':
ext_modules = [
Extension(
name='_watchdog_fsevents',
Expand Down

0 comments on commit 14a9406

Please sign in to comment.