at master 2.0 kB view raw
1From 5330b6af9f832af59aa5c61d9ef6971053a8e709 Mon Sep 17 00:00:00 2001 2From: Jonathan Ringer <jonringer117@gmail.com> 3Date: Mon, 9 Nov 2020 10:24:35 -0800 4Subject: [PATCH] CPython: Don't use ldconfig 5 6--- 7 Lib/ctypes/util.py | 77 ++-------------------------------------------- 8 1 file changed, 2 insertions(+), 75 deletions(-) 9 10diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py 11index 0c2510e161..7fb98af308 100644 12--- a/Lib/ctypes/util.py 13+++ b/Lib/ctypes/util.py 14@@ -268,34 +222,7 @@ def find_library(name, is64 = False): 15 else: 16 17 def _findSoname_ldconfig(name): 18- import struct 19- if struct.calcsize('l') == 4: 20- machine = os.uname().machine + '-32' 21- else: 22- machine = os.uname().machine + '-64' 23- mach_map = { 24- 'x86_64-64': 'libc6,x86-64', 25- 'ppc64-64': 'libc6,64bit', 26- 'sparc64-64': 'libc6,64bit', 27- 's390x-64': 'libc6,64bit', 28- 'ia64-64': 'libc6,IA-64', 29- } 30- abi_type = mach_map.get(machine, 'libc6') 31- 32- # XXX assuming GLIBC's ldconfig (with option -p) 33- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' 34- regex = os.fsencode(regex % (re.escape(name), abi_type)) 35- try: 36- with subprocess.Popen(['/sbin/ldconfig', '-p'], 37- stdin=subprocess.DEVNULL, 38- stderr=subprocess.DEVNULL, 39- stdout=subprocess.PIPE, 40- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: 41- res = re.search(regex, p.stdout.read()) 42- if res: 43- return os.fsdecode(res.group(1)) 44- except OSError: 45- pass 46+ return None 47 48 def _findLib_ld(name): 49 # See issue #9998 for why this is needed 50-- 512.33.1 52