diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-02-04 00:25:11 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-02-04 00:25:11 (GMT) |
commit | cfe34744e3c785a56525ab8a9473336206f5854d (patch) | |
tree | 0b4031608086e22686616345b80c5ed6cf4792ad /Lib/ctypes/util.py | |
parent | 7a34f02f9e651e8d021ceb759af102d9043b5a5b (diff) | |
download | cpython-cfe34744e3c785a56525ab8a9473336206f5854d.zip cpython-cfe34744e3c785a56525ab8a9473336206f5854d.tar.gz cpython-cfe34744e3c785a56525ab8a9473336206f5854d.tar.bz2 |
fix find_library on Solaris (closes #5289)
Diffstat (limited to 'Lib/ctypes/util.py')
-rw-r--r-- | Lib/ctypes/util.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index 5555b2e..1515604 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -166,6 +166,35 @@ elif os.name == "posix": 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): |