]> granicus.if.org Git - python/commitdiff
fix find_library on Solaris (closes #5289)
authorBenjamin Peterson <benjamin@python.org>
Mon, 4 Feb 2013 00:25:11 +0000 (19:25 -0500)
committerBenjamin Peterson <benjamin@python.org>
Mon, 4 Feb 2013 00:25:11 +0000 (19:25 -0500)
Lib/ctypes/util.py
Misc/ACKS
Misc/NEWS

index 7aee0eff99c72923461c884aed6b368f9fb0ce40..fe2b5205325da632b29ff976619309f66c02401c 100644 (file)
@@ -180,6 +180,35 @@ elif os.name == "posix":
             res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
             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):
index e811705e1e4d296c614b128e906af57d9a9f2e59..15bf415d328658893b6757ef6842a23152aa4444 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1044,6 +1044,7 @@ Charles Waldman
 Richard Walker
 Larry Wall
 Kevin Walzer
+Ke Wang
 Greg Ward
 Zachary Ware
 Barry Warsaw
index 1a91e8fca7207b888c281a9907d5d8a9f1611e27..dacfc8bd1d68d75d377ffcc62d97174ffc090c3e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -199,6 +199,8 @@ Core and Builtins
 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).