components/python/python27/patches/22-default-lib-path.patch
changeset 7516 09c933391a1b
parent 6445 0edecb568b2e
equal deleted inserted replaced
7513:0a979060f73b 7516:09c933391a1b
     1 This patch was developed in-house.  It has been submitted upstream:
     1 This patch was developed in-house.  It has been submitted upstream:
     2 http://bugs.python.org/issue23287
     2 http://bugs.python.org/issue23287
     3 
     3 
     4 --- Python-2.7.12/Lib/ctypes/util.py.~1~	2016-06-25 14:49:30.000000000 -0700
     4 --- Python-2.7.13/Lib/ctypes/util.py.~1~	2016-12-17 12:05:05.000000000 +0000
     5 +++ Python-2.7.12/Lib/ctypes/util.py	2016-07-07 14:25:48.212744320 -0700
     5 +++ Python-2.7.13/Lib/ctypes/util.py	2016-12-19 08:44:16.426321564 +0000
     6 @@ -176,23 +176,11 @@
     6 @@ -188,39 +188,15 @@
     7  
     7  
     8      elif sys.platform == "sunos5":
     8      elif sys.platform == "sunos5":
     9  
     9  
    10 -        def _findLib_crle(name, is64):
    10 -        def _findLib_crle(name, is64):
    11 -            if not os.path.exists('/usr/bin/crle'):
    11 -            if not os.path.exists('/usr/bin/crle'):
    12 -                return None
    12 -                return None
    13 -
       
    14 +        def _findLib_path(name, is64):
    13 +        def _findLib_path(name, is64):
       
    14  
       
    15              env = dict(os.environ)
       
    16              env['LC_ALL'] = 'C'
       
    17  
    15              if is64:
    18              if is64:
    16 -                cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
    19 -                args = ('/usr/bin/crle', '-64')
    17 +                paths = "/lib/64:/usr/lib/64"
    20 +                paths = "/lib/64:/usr/lib/64"
    18              else:
    21              else:
    19 -                cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
    22 -                args = ('/usr/bin/crle',)
    20 -
    23 -
    21 -            paths = None
    24 -            paths = None
    22 -            for line in os.popen(cmd).readlines():
    25 -            null = open(os.devnull, 'wb')
    23 -                line = line.strip()
    26 -            try:
    24 -                if line.startswith('Default Library Path (ELF):'):
    27 -                with null:
    25 -                    paths = line.split()[4]
    28 -                    proc = subprocess.Popen(args,
       
    29 -                                            stdout=subprocess.PIPE,
       
    30 -                                            stderr=null,
       
    31 -                                            env=env)
       
    32 -            except OSError:  # E.g. bad executable
       
    33 -                return None
       
    34 -            try:
       
    35 -                for line in proc.stdout:
       
    36 -                    line = line.strip()
       
    37 -                    if line.startswith(b'Default Library Path (ELF):'):
       
    38 -                        paths = line.split()[4]
       
    39 -            finally:
       
    40 -                proc.stdout.close()
       
    41 -                proc.wait()
    26 -
    42 -
    27 -            if not paths:
    43 -            if not paths:
    28 -                return None
    44 -                return None
    29 +                paths = "/lib:/usr/lib"
    45 +                paths = "/lib:/usr/lib"
    30  
    46  
    31              for dir in paths.split(":"):
    47              for dir in paths.split(":"):
    32                  libfile = os.path.join(dir, "lib%s.so" % name)
    48                  libfile = os.path.join(dir, "lib%s.so" % name)
    33 @@ -202,7 +190,7 @@
    49 @@ -230,7 +206,7 @@
    34              return None
    50              return None
    35  
    51  
    36          def find_library(name, is64 = False):
    52          def find_library(name, is64 = False):
    37 -            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
    53 -            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
    38 +            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
    54 +            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))