components/python/python35/patches/21-default-lib-path.patch
author John Beck <John.Beck@Oracle.COM>
Mon, 06 Feb 2017 13:54:36 -0800
changeset 7648 20e09cf3cfaa
parent 6447 56a2f066191a
permissions -rw-r--r--
25429083 Upgrade Python 3.5 line to 3.5.3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
This patch was developed in-house.  It has been submitted upstream:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
http://bugs.python.org/issue23287
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
     4
--- Python-3.5.3/Lib/ctypes/util.py.~1~	2016-12-17 12:05:05.000000000 +0000
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
     5
+++ Python-3.5.3/Lib/ctypes/util.py	2016-12-19 08:44:16.426321564 +0000
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
     6
@@ -214,34 +214,15 @@
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     7
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     8
     elif sys.platform == "sunos5":
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     9
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    10
-        def _findLib_crle(name, is64):
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    11
-            if not os.path.exists('/usr/bin/crle'):
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    12
-                return None
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    13
+        def _findLib_path(name, is64):
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    14
 
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    15
             env = dict(os.environ)
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    16
             env['LC_ALL'] = 'C'
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    17
 
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    18
             if is64:
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    19
-                args = ('/usr/bin/crle', '-64')
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
+                paths = "/lib/64:/usr/lib/64"
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
             else:
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    22
-                args = ('/usr/bin/crle',)
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    23
-
6447
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    24
-            paths = None
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    25
-            try:
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    26
-                proc = subprocess.Popen(args,
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    27
-                                        stdout=subprocess.PIPE,
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    28
-                                        stderr=subprocess.DEVNULL,
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    29
-                                        env=env)
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    30
-            except OSError:  # E.g. bad executable
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    31
-                return None
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    32
-            with proc:
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    33
-                for line in proc.stdout:
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    34
-                    line = line.strip()
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    35
-                    if line.startswith(b'Default Library Path (ELF):'):
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    36
-                        paths = os.fsdecode(line).split()[4]
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    37
-
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    38
-            if not paths:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    39
-                return None
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    40
+                paths = "/lib:/usr/lib"
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    41
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    42
             for dir in paths.split(":"):
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    43
                 libfile = os.path.join(dir, "lib%s.so" % name)
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    44
@@ -251,7 +227,7 @@
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    45
             return None
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    46
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    47
         def find_library(name, is64 = False):
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    48
-            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    49
+            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    50
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    51
     else:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    52