summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2012-02-14 04:22:06 (GMT)
committerMeador Inge <meadori@gmail.com>2012-02-14 04:22:06 (GMT)
commitff337ccd4bf9b6edea5aa25ea72f7d4c02a3bf47 (patch)
tree5f16ea3bb12d637a375d5fe94356e1158d2d9487 /Lib
parente1dbbbfc514dec56e6cf695cb7f127a4782ec6b7 (diff)
downloadcpython-ff337ccd4bf9b6edea5aa25ea72f7d4c02a3bf47.zip
cpython-ff337ccd4bf9b6edea5aa25ea72f7d4c02a3bf47.tar.gz
cpython-ff337ccd4bf9b6edea5aa25ea72f7d4c02a3bf47.tar.bz2
Issue #13979: Fix ctypes.util.find_library ldconfig regex
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/util.py25
1 files changed, 1 insertions, 24 deletions
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 52b3520..7aee0ef 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -182,28 +182,6 @@ elif os.name == "posix":
else:
- def _findLib_ldconfig(name):
- # XXX assuming GLIBC's ldconfig (with option -p)
- expr = r'/[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
- f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')
- try:
- data = f.read()
- finally:
- f.close()
- 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
- f = os.popen(cmd)
- try:
- data = f.read()
- finally:
- f.close()
- res = re.search(expr, data)
- if not res:
- return None
- return res.group(0)
-
def _findSoname_ldconfig(name):
import struct
if struct.calcsize('l') == 4:
@@ -220,8 +198,7 @@ elif os.name == "posix":
abi_type = mach_map.get(machine, 'libc6')
# XXX assuming GLIBC's ldconfig (with option -p)
- expr = r'(\S+)\s+\((%s(?:, OS ABI:[^\)]*)?)\)[^/]*(/[^\(\)\s]*lib%s\.[^\(\)\s]*)' \
- % (abi_type, re.escape(name))
+ expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)
f = os.popen('/sbin/ldconfig -p 2>/dev/null')
try:
data = f.read()