diff options
author | Sebastien Martini <seb@dbzteam.org> | 2014-07-06 18:12:58 +0200 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2014-07-06 18:12:58 +0200 |
commit | 12cf58b82bd81624fd8d87239697474cadf73c3a (patch) | |
tree | 8c16e724810a85834f10e9eb73bf63db40a75a70 | |
parent | 8e190d29cc7f70a25e30b9b798e27a1c997fe7f5 (diff) | |
download | pyinotify-12cf58b82bd81624fd8d87239697474cadf73c3a.tar.gz |
Stub support for Pyinotify on FreeBSD.
I don't have any FreeBSD system, so test it and report any issue
with this code.
Closes #64
-rwxr-xr-x | python2/pyinotify.py | 7 | ||||
-rwxr-xr-x | python3/pyinotify.py | 7 | ||||
-rwxr-xr-x | setup.py | 8 |
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. @@ -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. |