components/python/python27/patches/22-default-lib-path.patch
author John Beck <John.Beck@Oracle.COM>
Wed, 21 Jan 2015 17:55:00 -0800
changeset 3671 91f76aae1155
child 6445 0edecb568b2e
permissions -rw-r--r--
20381830 ctypes module unable to obtain default library path
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3671
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
This patch was developed in-house.  It has been submitted upstream:
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
http://bugs.python.org/issue23287
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     4
--- Python-2.7.9/Lib/ctypes/util.py.~1~	2014-12-10 07:59:34.000000000 -0800
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     5
+++ Python-2.7.9/Lib/ctypes/util.py	2015-01-20 15:22:03.139588641 -0800
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     6
@@ -182,22 +182,11 @@
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     7
 
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     8
     elif sys.platform == "sunos5":
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     9
 
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    10
-        def _findLib_crle(name, is64):
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    11
-            if not os.path.exists('/usr/bin/crle'):
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    12
-                return None
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    13
-
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    14
+        def _findLib_path(name, is64):
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    15
             if is64:
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    16
-                cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    17
+                paths = "/lib/64:/usr/lib/64"
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    18
             else:
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    19
-                cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
-
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
-            for line in os.popen(cmd).readlines():
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    22
-                line = line.strip()
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    23
-                if line.startswith('Default Library Path (ELF):'):
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    24
-                    paths = line.split()[4]
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    25
-
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    26
-            if not paths:
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    27
-                return None
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28
+                paths = "/lib:/usr/lib"
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    29
 
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    30
             for dir in paths.split(":"):
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    31
                 libfile = os.path.join(dir, "lib%s.so" % name)
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    32
@@ -207,7 +196,7 @@
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    33
             return None
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    34
 
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    35
         def find_library(name, is64 = False):
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    36
-            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    37
+            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    38
 
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    39
     else:
91f76aae1155 20381830 ctypes module unable to obtain default library path
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    40