]> granicus.if.org Git - python/commitdiff
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
authorThomas Heller <theller@ctypes.org>
Fri, 14 Sep 2007 20:05:26 +0000 (20:05 +0000)
committerThomas Heller <theller@ctypes.org>
Fri, 14 Sep 2007 20:05:26 +0000 (20:05 +0000)
Fixes issue #1777530; backported from trunk.

Lib/ctypes/util.py
Misc/NEWS

index f7133538bfaf31e38373cd86c3401cac5bc8ab30..fc17a2f93a1e43693f8c9d2cff459dc68e597905 100644 (file)
@@ -66,15 +66,27 @@ elif os.name == "posix":
             return None
         return res.group(0)
 
-    def _get_soname(f):
-        # assuming GNU binutils / ELF
-        if not f:
-            return None
-        cmd = "objdump -p -j .dynamic 2>/dev/null " + f
-        res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
-        if not res:
-            return None
-        return res.group(1)
+
+    if sys.platform == "sunos5":
+        # use /usr/ccs/bin/dump on solaris
+        def _get_soname(f):
+            if not f:
+                return None
+            cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f
+            res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', os.popen(cmd).read())
+            if not res:
+                return None
+            return res.group(1)
+    else:
+        def _get_soname(f):
+            # assuming GNU binutils / ELF
+            if not f:
+                return None
+            cmd = "objdump -p -j .dynamic 2>/dev/null " + f
+            res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
+            if not res:
+                return None
+            return res.group(1)
 
     if (sys.platform.startswith("freebsd")
         or sys.platform.startswith("openbsd")
index 6c87b1c61c6ac7b91e1c1365b47300a48dc27892..640ba3176594078eac7f3efe77e121a949ae0d31 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,9 @@ Core and builtins
 Library
 -------
 
+- Bug #1777530: ctypes.util.find_library uses dump(1) instead of
+  objdump(1) on Solaris.
+
 - Bug #1153: repr.repr() now doesn't require set and dictionary items
   to be orderable to properly represent them.