Issue #21042: Return full path in ctypes.util.find_library() on Linux

Patch by Tamás Bence Gedai.
This commit is contained in:
Martin Panter 2016-03-10 01:06:23 +00:00
parent aadaa3614e
commit b9f3114d42
5 changed files with 37 additions and 22 deletions

View file

@ -221,8 +221,8 @@ def _findSoname_ldconfig(name):
abi_type = mach_map.get(machine, 'libc6')
# XXX assuming GLIBC's ldconfig (with option -p)
regex = os.fsencode(
'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type))
regex = r'lib%s\.[^\s]+\s\(%s(?:,\s.*)?\)\s=>\s(.*)'
regex = os.fsencode(regex % (re.escape(name), abi_type))
try:
with subprocess.Popen(['/sbin/ldconfig', '-p'],
stdin=subprocess.DEVNULL,