0001-Workaround-finding-libudev-on-systems-without-ldconf.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From e86a1c199d45c9751da67f947af202927dee07f8 Mon Sep 17 00:00:00 2001
  2. From: Yegor Yefremov <yegorslists@googlemail.com>
  3. Date: Thu, 10 Dec 2015 08:44:55 +0100
  4. Subject: [PATCH] Workaround finding libudev on systems without ldconf
  5. This patch tries to load libudev.so directly without relying on
  6. Python's find_library(). find_library() fails on systems
  7. without library cache mechanism.
  8. Taken from pyudev issue 117 discussion:
  9. https://github.com/pyudev/pyudev/pull/117
  10. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
  11. ---
  12. src/pyudev/_libudev.py | 8 ++++----
  13. 1 file changed, 4 insertions(+), 4 deletions(-)
  14. diff --git a/src/pyudev/_libudev.py b/src/pyudev/_libudev.py
  15. index a0de8fb..1348d17 100644
  16. --- a/src/pyudev/_libudev.py
  17. +++ b/src/pyudev/_libudev.py
  18. @@ -30,7 +30,7 @@
  19. from __future__ import (print_function, division, unicode_literals,
  20. absolute_import)
  21. -from ctypes import (CDLL, Structure, POINTER,
  22. +from ctypes import (cdll, CDLL, Structure, POINTER,
  23. c_char, c_char_p, c_int, c_uint, c_ulonglong)
  24. from ctypes.util import find_library
  25. @@ -265,10 +265,10 @@ def load_udev_library():
  26. Raise :exc:`~exceptions.ImportError`, if the udev library was not found.
  27. """
  28. - udev_library_name = find_library('udev')
  29. - if not udev_library_name:
  30. + try:
  31. + libudev = cdll.LoadLibrary('libudev.so')
  32. + except OSError:
  33. raise ImportError('No library named udev')
  34. - libudev = CDLL(udev_library_name, use_errno=True)
  35. # context function signature
  36. for namespace, members in SIGNATURES.items():
  37. for funcname in members:
  38. --
  39. 2.1.4