at 16.09-beta 3.8 kB view raw
1diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py 2index b2c514d..a6eca81 100644 3--- a/Lib/ctypes/util.py 4+++ b/Lib/ctypes/util.py 5@@ -207,31 +207,7 @@ elif os.name == "posix": 6 else: 7 8 def _findSoname_ldconfig(name): 9- import struct 10- if struct.calcsize('l') == 4: 11- machine = os.uname()[4] + '-32' 12- else: 13- machine = os.uname()[4] + '-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- expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type) 25- f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null') 26- try: 27- data = f.read() 28- finally: 29- f.close() 30- res = re.search(expr, data) 31- if not res: 32- return None 33- return res.group(1) 34+ return None 35 36 def find_library(name): 37 return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) 38diff --git a/Lib/uuid.py b/Lib/uuid.py 39index 7432032..9829d18 100644 40--- a/Lib/uuid.py 41+++ b/Lib/uuid.py 42@@ -437,57 +437,7 @@ def _netbios_getnode(): 43 return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) + 44 (bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5]) 45 46-# Thanks to Thomas Heller for ctypes and for his help with its use here. 47- 48-# If ctypes is available, use it to find system routines for UUID generation. 49 _uuid_generate_time = _UuidCreate = None 50-try: 51- import ctypes, ctypes.util 52- import sys 53- 54- # The uuid_generate_* routines are provided by libuuid on at least 55- # Linux and FreeBSD, and provided by libc on Mac OS X. 56- _libnames = ['uuid'] 57- if not sys.platform.startswith('win'): 58- _libnames.append('c') 59- for libname in _libnames: 60- try: 61- lib = ctypes.CDLL(ctypes.util.find_library(libname)) 62- except: 63- continue 64- if hasattr(lib, 'uuid_generate_time'): 65- _uuid_generate_time = lib.uuid_generate_time 66- break 67- del _libnames 68- 69- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted 70- # in issue #8621 the function generates the same sequence of values 71- # in the parent process and all children created using fork (unless 72- # those children use exec as well). 73- # 74- # Assume that the uuid_generate functions are broken from 10.5 onward, 75- # the test can be adjusted when a later version is fixed. 76- if sys.platform == 'darwin': 77- import os 78- if int(os.uname()[2].split('.')[0]) >= 9: 79- _uuid_generate_time = None 80- 81- # On Windows prior to 2000, UuidCreate gives a UUID containing the 82- # hardware address. On Windows 2000 and later, UuidCreate makes a 83- # random UUID and UuidCreateSequential gives a UUID containing the 84- # hardware address. These routines are provided by the RPC runtime. 85- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last 86- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear 87- # to bear any relationship to the MAC address of any network device 88- # on the box. 89- try: 90- lib = ctypes.windll.rpcrt4 91- except: 92- lib = None 93- _UuidCreate = getattr(lib, 'UuidCreateSequential', 94- getattr(lib, 'UuidCreate', None)) 95-except: 96- pass 97 98 def _unixdll_getnode(): 99 """Get the hardware address on Unix using ctypes."""