summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2012-02-14 04:08:39 (GMT)
committerMeador Inge <meadori@gmail.com>2012-02-14 04:08:39 (GMT)
commitffeee3518a9ccb0d6375bf06abe2cf8a6bc9e5b8 (patch)
tree841fe003cd0e9a96b30cc4c94b49fa4f3d0707ae /Lib
parenta127ecb7a2a1ba0abf74a0eeaa905f2dc87fa69f (diff)
downloadcpython-ffeee3518a9ccb0d6375bf06abe2cf8a6bc9e5b8.zip
cpython-ffeee3518a9ccb0d6375bf06abe2cf8a6bc9e5b8.tar.gz
cpython-ffeee3518a9ccb0d6375bf06abe2cf8a6bc9e5b8.tar.bz2
Issue #13979: Fix ctypes.util.find_library ldconfig regex
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/util.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 1881e89..1bb7d1d 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -171,22 +171,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)
- 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):
import struct
if struct.calcsize('l') == 4:
@@ -203,8 +187,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)
with contextlib.closing(os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')) as f:
data = f.read()
res = re.search(expr, data)