Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_load_libc is not needed #776

Merged
merged 1 commit into from
May 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions src/watchdog/observers/inotify_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,7 @@
from ctypes import c_int, c_char_p, c_uint32
from watchdog.utils import UnsupportedLibc


def _load_libc():
libc_path = None
try:
libc_path = ctypes.util.find_library('c')
except (OSError, RuntimeError):
# Note: find_library will on some platforms raise these undocumented
# errors, e.g.on android OSError "No usable temporary directory found"
# will be raised.
pass

if libc_path is not None:
return ctypes.CDLL(libc_path)

# Fallbacks
try:
return ctypes.CDLL('libc.so')
except OSError:
pass

try:
return ctypes.CDLL('libc.so.6')
except OSError:
pass

# uClibc
try:
return ctypes.CDLL('libc.so.0')
except OSError as err:
raise err


libc = _load_libc()
libc = ctypes.CDLL(None)

if not hasattr(libc, 'inotify_init') or \
not hasattr(libc, 'inotify_add_watch') or \
Expand Down