components/python/python26/patches/Python26-14-ctypes-util-find-library.patch
changeset 3671 91f76aae1155
parent 115 c360825c3a3f
equal deleted inserted replaced
3669:91c379bcac7e 3671:91f76aae1155
     1 diff --git Python-2.6.4/Lib/ctypes/util.py Python-2.6.4/Lib/ctypes/util.py
     1 This patch was developed in-house, but not contributed upstream because
     2 --- Python-2.6.4/Lib/ctypes/util.py
     2 Python 2.6 has been abandoned by the community.
     3 +++ Python-2.6.4/Lib/ctypes/util.py
     3 
     4 @@ -164,6 +164,35 @@
     4 --- Python-2.6.8/Lib/ctypes/util.py.~1~	2012-04-10 08:32:04.000000000 -0700
       
     5 +++ Python-2.6.8/Lib/ctypes/util.py	2015-01-20 15:17:51.156728249 -0800
       
     6 @@ -164,6 +164,24 @@
     5              res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
     7              res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
     6              return res[-1]
     8              return res[-1]
     7  
     9  
     8 +    elif sys.platform == "sunos5":
    10 +    elif sys.platform == "sunos5":
     9 +
    11 +
    10 +        def _findLib_crle(name, is64):
    12 +        def _findLib_path(name, is64):
    11 +            if not os.path.exists('/usr/bin/crle'):
       
    12 +                return None
       
    13 +
       
    14 +            if is64:
    13 +            if is64:
    15 +                cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
    14 +                paths = "/lib/64:/usr/lib/64"
    16 +            else:
    15 +            else:
    17 +                cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
    16 +                paths = "/lib:/usr/lib"
    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 +
    17 +
    27 +            for dir in paths.split(":"):
    18 +            for dir in paths.split(":"):
    28 +                libfile = os.path.join(dir, "lib%s.so" % name)
    19 +                libfile = os.path.join(dir, "lib%s.so" % name)
    29 +                if os.path.exists(libfile):
    20 +                if os.path.exists(libfile):
    30 +                    return libfile
    21 +                    return libfile
    31 +
    22 +
    32 +            return None
    23 +            return None
    33 +        
    24 +        
    34 +        def find_library(name, is64 = False):
    25 +        def find_library(name, is64 = False):
    35 +            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
    26 +            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
    36 +
    27 +
    37      else:
    28      else:
    38  
    29  
    39          def _findLib_ldconfig(name):
    30          def _findLib_ldconfig(name):