Skip to content

Commit 14a9406

Browse files
committed
[mac] Prevent compilation of watchdog_fsevents.c on non-macOS machines
1 parent d35ef6b commit 14a9406

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Changelog
1212
- Replace mutable default arguments with ``if None`` implementation (`#677 <https://github.com/gorakhargosh/watchdog/pull/677>`_)
1313
- Expand tests to Python 2.7 and 3.5-3.10 for GNU/Linux, macOS and Windows
1414
- [mac] Performance improvements for the `fsevents` module (`#680 <https://github.com/gorakhargosh/watchdog/pull/680>`_)
15+
- [mac] Prevent compilation of ``watchdog_fsevents.c`` on non-macOS machines (`#687 <https://github.com/gorakhargosh/watchdog/pull/687>`_)
1516
- Handle shutdown events from SIGTERM and SIGINT to `watchmedo` more reliably (`#693 <https://github.com/gorakhargosh/watchdog/pull/693>`_)
1617
- Thanks to our beloved contributors: @Sraw, @CCP-Aporia, @BoboTiG, @maybe-sybr
1718

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
# limitations under the License.
1818

1919
import sys
20+
import os
2021
import os.path
2122
from codecs import open
23+
from platform import machine
2224
from setuptools import setup, find_packages
2325
from setuptools.extension import Extension
2426
from setuptools.command.build_ext import build_ext
@@ -36,8 +38,13 @@
3638
import imp
3739
version = imp.load_source('version', os.path.join(WATCHDOG_PKG_DIR, 'version.py'))
3840

41+
# Ignored Apple devices on which compiling watchdog_fsevents.c would fail.
42+
# The FORCE_MACOS_MACHINE envar, when set to 1, will force the compilation.
43+
_apple_devices = ('appletv', 'iphone', 'ipod', 'ipad', 'watch')
44+
is_macos = sys.platform == 'darwin' and not machine().lower().startswith(_apple_devices)
45+
3946
ext_modules = []
40-
if sys.platform == 'darwin':
47+
if is_macos or os.getenv('FORCE_MACOS_MACHINE', '0') == '1':
4148
ext_modules = [
4249
Extension(
4350
name='_watchdog_fsevents',

0 commit comments

Comments
 (0)