diff options
author | Sebastien Martini <seb@dbzteam.org> | 2010-07-27 12:40:18 +0200 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2010-07-27 12:40:18 +0200 |
commit | 77f9641291794db929a8a891137998b982f7585f (patch) | |
tree | 661bbb02e25b5fde5c4a972ff0b74f96d1cdbd7c /python3 | |
parent | ec5a9f42c0e79d2017818cc2f522efd61cbc7952 (diff) | |
download | pyinotify-77f9641291794db929a8a891137998b982f7585f.tar.gz |
Check that loaded libc has needed inotify functions instead of
checking for glibc version number (reported by
przemyslaw.wrzos@calyptech.com).
Diffstat (limited to 'python3')
-rwxr-xr-x | python3/pyinotify.py | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/python3/pyinotify.py b/python3/pyinotify.py index c8d5cf4..d9b9dfc 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -51,14 +51,9 @@ class UnsupportedLibcVersionError(PyinotifyError): """ Raised on unsupported libc versions. """ - def __init__(self, version): - """ - @param version: Current Libc version - @type version: string - """ - PyinotifyError.__init__(self, - ('Libc %s is not supported, requires ' - 'at least Libc 2.4') % version) + def __init__(self): + err = 'libc does not provide required inotify support' + PyinotifyError.__init__(self, err) # Check Python version @@ -111,17 +106,11 @@ def STRERRNO(): code = ctypes.get_errno() return '%s (%s)' % (os.strerror(code), errno.errorcode[code]) -# The libc version > 2.4 check. -# XXX: Maybe it is better to check if the libc has the needed functions inside? -# Because there are inotify patches for libc 2.3.6. -LIBC.gnu_get_libc_version.restype = ctypes.c_char_p -LIBC_VERSION = LIBC.gnu_get_libc_version() -if not isinstance(LIBC_VERSION, str): - LIBC_VERSION = LIBC_VERSION.decode() -if (int(LIBC_VERSION.split('.')[0]) < 2 or - (int(LIBC_VERSION.split('.')[0]) == 2 and - int(LIBC_VERSION.split('.')[1]) < 4)): - raise UnsupportedLibcVersionError(LIBC_VERSION) +# Check that libc has needed functions inside. +if (not hasattr(LIBC, 'inotify_init') or + not hasattr(LIBC, 'inotify_add_watch') or + not hasattr(LIBC, 'inotify_rm_watch')): + raise UnsupportedLibcVersionError() class PyinotifyLogger(logging.Logger): |