python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / package / python-pyudev / 0001-Workaround-finding-libudev-on-systems-without-ldconf.patch
blob93b9568593f638dbb69c96c0522a45a2fa5c1cff
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
6 This patch tries to load libudev.so directly without relying on
7 Python's find_library(). find_library() fails on systems
8 without library cache mechanism.
10 Taken from pyudev issue 117 discussion:
11 https://github.com/pyudev/pyudev/pull/117
13 Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
14 ---
15 src/pyudev/_libudev.py | 8 ++++----
16 1 file changed, 4 insertions(+), 4 deletions(-)
18 diff --git a/src/pyudev/_libudev.py b/src/pyudev/_libudev.py
19 index a0de8fb..1348d17 100644
20 --- a/src/pyudev/_libudev.py
21 +++ b/src/pyudev/_libudev.py
22 @@ -30,7 +30,7 @@
23 from __future__ import (print_function, division, unicode_literals,
24 absolute_import)
26 -from ctypes import (CDLL, Structure, POINTER,
27 +from ctypes import (cdll, CDLL, Structure, POINTER,
28 c_char, c_char_p, c_int, c_uint, c_ulonglong)
29 from ctypes.util import find_library
31 @@ -265,10 +265,10 @@ def load_udev_library():
33 Raise :exc:`~exceptions.ImportError`, if the udev library was not found.
34 """
35 - udev_library_name = find_library('udev')
36 - if not udev_library_name:
37 + try:
38 + libudev = cdll.LoadLibrary('libudev.so')
39 + except OSError:
40 raise ImportError('No library named udev')
41 - libudev = CDLL(udev_library_name, use_errno=True)
42 # context function signature
43 for namespace, members in SIGNATURES.items():
44 for funcname in members:
45 --
46 2.1.4