at master 1.6 kB view raw
1diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py 2index 117bf06cb01..ff50cb083bd 100644 3--- a/Lib/ctypes/util.py 4+++ b/Lib/ctypes/util.py 5@@ -280,34 +280,7 @@ def find_library(name, is64 = False): 6 else: 7 8 def _findSoname_ldconfig(name): 9- import struct 10- if struct.calcsize('l') == 4: 11- machine = os.uname().machine + '-32' 12- else: 13- machine = os.uname().machine + '-64' 14- mach_map = { 15- 'x86_64-64': 'libc6,x86-64', 16- 'ppc64-64': 'libc6,64bit', 17- 'sparc64-64': 'libc6,64bit', 18- 's390x-64': 'libc6,64bit', 19- 'ia64-64': 'libc6,IA-64', 20- } 21- abi_type = mach_map.get(machine, 'libc6') 22- 23- # XXX assuming GLIBC's ldconfig (with option -p) 24- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' 25- regex = os.fsencode(regex % (re.escape(name), abi_type)) 26- try: 27- with subprocess.Popen(['/sbin/ldconfig', '-p'], 28- stdin=subprocess.DEVNULL, 29- stderr=subprocess.DEVNULL, 30- stdout=subprocess.PIPE, 31- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: 32- res = re.search(regex, p.stdout.read()) 33- if res: 34- return os.fsdecode(res.group(1)) 35- except OSError: 36- pass 37+ return None 38 39 def _findLib_ld(name): 40 # See issue #9998 for why this is needed