diff options
author | Thomas Heller <theller@ctypes.org> | 2007-09-14 19:40:35 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2007-09-14 19:40:35 (GMT) |
commit | a7f49f733bea5ff7aa57be30559cff4b7cc77565 (patch) | |
tree | e4479a9066c46e2fa24beec06a2c505a70fc03ed /Lib | |
parent | 7c82a3e9c6c73fd15741f44afedffe29c4a9d9c7 (diff) | |
download | cpython-a7f49f733bea5ff7aa57be30559cff4b7cc77565.zip cpython-a7f49f733bea5ff7aa57be30559cff4b7cc77565.tar.gz cpython-a7f49f733bea5ff7aa57be30559cff4b7cc77565.tar.bz2 |
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Fixes issue #1777530; will backport to release25-maint.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/util.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index f713353..fc17a2f 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -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") |