components/python/python26/patches/Python26-14-ctypes-util-find-library.patch
changeset 115 c360825c3a3f
parent 99 c15c9099bb44
child 3671 91f76aae1155
equal deleted inserted replaced
114:6cc95ec7b1bb 115:c360825c3a3f
       
     1 diff --git Python-2.6.4/Lib/ctypes/util.py Python-2.6.4/Lib/ctypes/util.py
       
     2 --- Python-2.6.4/Lib/ctypes/util.py
       
     3 +++ Python-2.6.4/Lib/ctypes/util.py
       
     4 @@ -164,6 +164,35 @@
       
     5              res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
       
     6              return res[-1]
       
     7  
       
     8 +    elif sys.platform == "sunos5":
       
     9 +
       
    10 +        def _findLib_crle(name, is64):
       
    11 +            if not os.path.exists('/usr/bin/crle'):
       
    12 +                return None
       
    13 +
       
    14 +            if is64:
       
    15 +                cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
       
    16 +            else:
       
    17 +                cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
       
    18 +
       
    19 +            for line in os.popen(cmd).readlines():
       
    20 +                line = line.strip()
       
    21 +                if (line.startswith('Default Library Path (ELF):')):
       
    22 +                    paths = line.split()[4]
       
    23 +
       
    24 +            if not paths:
       
    25 +                return None
       
    26 +
       
    27 +            for dir in paths.split(":"):
       
    28 +                libfile = os.path.join(dir, "lib%s.so" % name)
       
    29 +                if os.path.exists(libfile):
       
    30 +                    return libfile
       
    31 +
       
    32 +            return None
       
    33 +        
       
    34 +        def find_library(name, is64 = False):
       
    35 +            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
       
    36 +
       
    37      else:
       
    38  
       
    39          def _findLib_ldconfig(name):