components/python/python27/patches/20-ctypes-util-find-library.patch
changeset 1914 00e8dbcb9b1e
parent 1913 bf893655bc39
child 1915 c02f96475fe6
equal deleted inserted replaced
1913:bf893655bc39 1914:00e8dbcb9b1e
     1 This patch comes from upstream: http://bugs.python.org/issue5289
       
     2 If we ever upgrade to 2.7.4 or later, it will no longer be needed.
       
     3 
       
     4 --- Python-2.7.3/Lib/ctypes/util.py~
       
     5 +++ Python-2.7.3/Lib/ctypes/util.py
       
     6 @@ -180,6 +180,35 @@ elif os.name == "posix":
       
     7              res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
       
     8              return res[-1]
       
     9  
       
    10 +    elif sys.platform == "sunos5":
       
    11 +
       
    12 +        def _findLib_crle(name, is64):
       
    13 +            if not os.path.exists('/usr/bin/crle'):
       
    14 +                return None
       
    15 +
       
    16 +            if is64:
       
    17 +                cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
       
    18 +            else:
       
    19 +                cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
       
    20 +
       
    21 +            for line in os.popen(cmd).readlines():
       
    22 +                line = line.strip()
       
    23 +                if line.startswith('Default Library Path (ELF):'):
       
    24 +                    paths = line.split()[4]
       
    25 +
       
    26 +            if not paths:
       
    27 +                return None
       
    28 +
       
    29 +            for dir in paths.split(":"):
       
    30 +                libfile = os.path.join(dir, "lib%s.so" % name)
       
    31 +                if os.path.exists(libfile):
       
    32 +                    return libfile
       
    33 +
       
    34 +            return None
       
    35 +
       
    36 +        def find_library(name, is64 = False):
       
    37 +            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
       
    38 +
       
    39      else:
       
    40  
       
    41          def _findSoname_ldconfig(name):