opendreambox.conf: bump distro version to 2.4
[opendreambox.git] / meta-opendreambox / recipes-devtools / python / python / no-ldconfig.patch
1 Fixes exception on 'import uuid' if ldconfig is unavailable.
2
3 diff -Naur Python-2.6.7.orig/Lib/ctypes/util.py Python-2.6.7/Lib/ctypes/util.py
4 --- Python-2.6.7.orig/Lib/ctypes/util.py        2010-03-20 03:11:16.000000000 +0100
5 +++ Python-2.6.7/Lib/ctypes/util.py     2012-01-12 15:26:37.562726637 +0100
6 @@ -204,7 +204,16 @@
7              return res.group(1)
8  
9          def find_library(name):
10 -            return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
11 +            from glob import glob
12 +            paths = ['/lib', '/usr/lib']
13 +            if os.environ.has_key('LD_LIBRARY_PATH'):
14 +                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
15 +            for path in paths:
16 +                for lib in glob("%s/lib%s.so.*" % (path, name)):
17 +                    rpath = os.path.realpath(lib)
18 +                    if os.path.isfile(rpath):
19 +                        return rpath
20 +            return None
21  
22  ################################################################
23  # test code