summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpython2/pyinotify.py7
-rwxr-xr-xpython3/pyinotify.py7
-rwxr-xr-xsetup.py8
3 files changed, 18 insertions, 4 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py
index 4f07d65..c989d47 100755
--- a/python2/pyinotify.py
+++ b/python2/pyinotify.py
@@ -202,9 +202,14 @@ class _CtypesLibcINotifyWrapper(INotifyWrapper):
def init(self):
assert ctypes
+
+ try_libc_name = 'c'
+ if sys.platform.startswith('freebsd'):
+ try_libc_name = 'inotify'
+
libc_name = None
try:
- libc_name = ctypes.util.find_library('c')
+ libc_name = ctypes.util.find_library(try_libc_name)
except (OSError, IOError):
pass # Will attemp to load it with None anyway.
diff --git a/python3/pyinotify.py b/python3/pyinotify.py
index 67a7000..ead7be0 100755
--- a/python3/pyinotify.py
+++ b/python3/pyinotify.py
@@ -200,9 +200,14 @@ class _CtypesLibcINotifyWrapper(INotifyWrapper):
def init(self):
assert ctypes
+
+ try_libc_name = 'c'
+ if sys.platform.startswith('freebsd'):
+ try_libc_name = 'inotify'
+
libc_name = None
try:
- libc_name = ctypes.util.find_library('c')
+ libc_name = ctypes.util.find_library(try_libc_name)
except (OSError, IOError):
pass # Will attemp to load it with None anyway.
diff --git a/setup.py b/setup.py
index c318749..355340d 100755
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ if sys.version_info < (2, 4):
sys.exit(1)
# check linux platform
-if not platform.startswith('linux'):
+if not platform.startswith('linux') and not platform.startswith('freebsd'):
sys.stderr.write("inotify is not available on %s\n" % platform)
sys.exit(1)
@@ -66,9 +66,13 @@ def should_compile_ext_mod():
except:
return True
+ try_libc_name = 'c'
+ if platform.startswith('freebsd'):
+ try_libc_name = 'inotify'
+
libc_name = None
try:
- libc_name = ctypes.util.find_library('c')
+ libc_name = ctypes.util.find_library(try_libc_name)
except:
pass # Will attemp to load it with None anyway.