[Python-checkins] cpython (merge 3.3 -> default): merge 3.3 (#5289)

benjamin.peterson python-checkins at python.org
Mon Feb 4 01:27:30 CET 2013


http://hg.python.org/cpython/rev/640a80adb9df
changeset:   81984:640a80adb9df
parent:      81981:6f95d202fe86
parent:      81983:73574de2068b
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Feb 03 19:26:51 2013 -0500
summary:
  merge 3.3 (#5289)

files:
  Lib/ctypes/util.py |  29 +++++++++++++++++++++++++++++
  Misc/ACKS          |   1 +
  Misc/NEWS          |   2 ++
  3 files changed, 32 insertions(+), 0 deletions(-)


diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -166,6 +166,35 @@
             res.sort(key=_num_version)
             return res[-1]
 
+    elif sys.platform == "sunos5":
+
+        def _findLib_crle(name, is64):
+            if not os.path.exists('/usr/bin/crle'):
+                return None
+
+            if is64:
+                cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
+            else:
+                cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
+
+            for line in os.popen(cmd).readlines():
+                line = line.strip()
+                if line.startswith('Default Library Path (ELF):'):
+                    paths = line.split()[4]
+
+            if not paths:
+                return None
+
+            for dir in paths.split(":"):
+                libfile = os.path.join(dir, "lib%s.so" % name)
+                if os.path.exists(libfile):
+                    return libfile
+
+            return None
+
+        def find_library(name, is64 = False):
+            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+
     else:
 
         def _findSoname_ldconfig(name):
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1263,6 +1263,7 @@
 Larry Wall
 Kevin Walzer
 Rodrigo Steinmuller Wanderley
+Ke Wang
 Greg Ward
 Zachary Ware
 Barry Warsaw
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -235,6 +235,8 @@
 Library
 -------
 
+- Issue #5289: Fix ctypes.util.find_library on Solaris.
+
 - Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
   stream or a decoder produces data of an unexpected type (i.e. when
   io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec).

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list