[Python-modules-team] Bug#651865: python-gnutls: gnutls.library.functions fails with libgnutls28-3.0.8-2

Jakub Wilk jwilk at debian.org
Sat Feb 25 16:55:12 UTC 2012


* gregor herrmann <gregoa at debian.org>, 2012-02-25, 16:30:
>--- gnutls/library/__init__.py	2010-01-26 13:46:04.000000000 +0100
>+++ /tmp/python-gnutls-1.2.4/gnutls/library/__init__.py	2011-11-11 18:23:49.000000000 +0100
>@@ -15,39 +15,29 @@
> 
> def library_locations(name, version):
>     import os
>-    from ctypes.util import find_library
>-    
>+
>     system = get_system_name()
>     if system == 'darwin':
[snip - code from other OSes]
>     else:
>         library_name = 'lib%s.so.%d' % (name, version)
>-        library_alias = 'lib%s.so' % name
>-        search_name = name
>+        dynamic_loader_env_vars = ['LD_LIBRARY_PATH']
>         additional_paths = ['/usr/local/lib']
>-    library = find_library(search_name)
>-    if library is not None:
>-        yield library
>-    library = find_library(library_name)
>-    if library is not None:
>-        yield library
>-    for path in additional_paths:
>+    for path in (path for env_var in dynamic_loader_env_vars for path in os.environ.get(env_var, '').split(':') if os.path.isdir(path)):
>         yield os.path.join(path, library_name)
>+    yield library_name
>     for path in additional_paths:
>-        yield os.path.join(path, library_alias)
>+        yield os.path.join(path, library_name)

This all appears unnecessarily complicated: the dynamic linker would 
find the library itself, there's no need to iterate over LD_LIBARY_PATH 
or explicitly look into /usr/local/lib. But other than that, the patch 
looks good.

-- 
Jakub Wilk





More information about the Python-modules-team mailing list