Issue #13979: Fix ctypes.util.find_library ldconfig regex
This commit is contained in:
parent
a127ecb7a2
commit
ffeee3518a
@ -171,22 +171,6 @@ elif os.name == "posix":
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
def _findLib_ldconfig(name):
|
|
||||||
# XXX assuming GLIBC's ldconfig (with option -p)
|
|
||||||
expr = r'/[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
|
|
||||||
with contextlib.closing(os.popen('/sbin/ldconfig -p 2>/dev/null')) as f:
|
|
||||||
data = f.read()
|
|
||||||
res = re.search(expr, data)
|
|
||||||
if not res:
|
|
||||||
# Hm, this works only for libs needed by the python executable.
|
|
||||||
cmd = 'ldd %s 2>/dev/null' % sys.executable
|
|
||||||
with contextlib.closing(os.popen(cmd)) as f:
|
|
||||||
data = f.read()
|
|
||||||
res = re.search(expr, data)
|
|
||||||
if not res:
|
|
||||||
return None
|
|
||||||
return res.group(0)
|
|
||||||
|
|
||||||
def _findSoname_ldconfig(name):
|
def _findSoname_ldconfig(name):
|
||||||
import struct
|
import struct
|
||||||
if struct.calcsize('l') == 4:
|
if struct.calcsize('l') == 4:
|
||||||
@ -203,8 +187,7 @@ elif os.name == "posix":
|
|||||||
abi_type = mach_map.get(machine, 'libc6')
|
abi_type = mach_map.get(machine, 'libc6')
|
||||||
|
|
||||||
# XXX assuming GLIBC's ldconfig (with option -p)
|
# XXX assuming GLIBC's ldconfig (with option -p)
|
||||||
expr = r'(\S+)\s+\((%s(?:, OS ABI:[^\)]*)?)\)[^/]*(/[^\(\)\s]*lib%s\.[^\(\)\s]*)' \
|
expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)
|
||||||
% (abi_type, re.escape(name))
|
|
||||||
with contextlib.closing(os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')) as f:
|
with contextlib.closing(os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')) as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
res = re.search(expr, data)
|
res = re.search(expr, data)
|
||||||
|
@ -113,6 +113,9 @@ Core and Builtins
|
|||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #13979: A bug in ctypes.util.find_library that caused
|
||||||
|
the wrong library name to be returned has been fixed.
|
||||||
|
|
||||||
- Issue #13993: HTMLParser is now able to handle broken end tags when
|
- Issue #13993: HTMLParser is now able to handle broken end tags when
|
||||||
strict=False.
|
strict=False.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user