|
| 1 | +diff -Naur Python-2.7.2.org/Lib/platform.py Python-2.7.2/Lib/platform.py |
| 2 | +--- Python-2.7.2.org/Lib/platform.py 2016-03-26 18:37:49.968335997 +0800 |
| 3 | ++++ Python-2.7.2/Lib/platform.py 2016-03-26 18:40:02.708338807 +0800 |
| 4 | +@@ -160,35 +160,39 @@ |
| 5 | + # here to work around problems with Cygwin not being |
| 6 | + # able to open symlinks for reading |
| 7 | + executable = os.path.realpath(executable) |
| 8 | +- f = open(executable,'rb') |
| 9 | +- binary = f.read(chunksize) |
| 10 | +- pos = 0 |
| 11 | +- while 1: |
| 12 | +- m = _libc_search.search(binary,pos) |
| 13 | +- if not m: |
| 14 | +- binary = f.read(chunksize) |
| 15 | +- if not binary: |
| 16 | +- break |
| 17 | +- pos = 0 |
| 18 | +- continue |
| 19 | +- libcinit,glibc,glibcversion,so,threads,soversion = m.groups() |
| 20 | +- if libcinit and not lib: |
| 21 | +- lib = 'libc' |
| 22 | +- elif glibc: |
| 23 | +- if lib != 'glibc': |
| 24 | +- lib = 'glibc' |
| 25 | +- version = glibcversion |
| 26 | +- elif glibcversion > version: |
| 27 | +- version = glibcversion |
| 28 | +- elif so: |
| 29 | +- if lib != 'glibc': |
| 30 | ++ try: |
| 31 | ++ f = open(executable,'rb') |
| 32 | ++ binary = f.read(chunksize) |
| 33 | ++ pos = 0 |
| 34 | ++ while 1: |
| 35 | ++ m = _libc_search.search(binary,pos) |
| 36 | ++ if not m: |
| 37 | ++ binary = f.read(chunksize) |
| 38 | ++ if not binary: |
| 39 | ++ break |
| 40 | ++ pos = 0 |
| 41 | ++ continue |
| 42 | ++ libcinit,glibc,glibcversion,so,threads,soversion = m.groups() |
| 43 | ++ if libcinit and not lib: |
| 44 | + lib = 'libc' |
| 45 | +- if soversion > version: |
| 46 | +- version = soversion |
| 47 | +- if threads and version[-len(threads):] != threads: |
| 48 | +- version = version + threads |
| 49 | +- pos = m.end() |
| 50 | +- f.close() |
| 51 | ++ elif glibc: |
| 52 | ++ if lib != 'glibc': |
| 53 | ++ lib = 'glibc' |
| 54 | ++ version = glibcversion |
| 55 | ++ elif glibcversion > version: |
| 56 | ++ version = glibcversion |
| 57 | ++ elif so: |
| 58 | ++ if lib != 'glibc': |
| 59 | ++ lib = 'libc' |
| 60 | ++ if soversion > version: |
| 61 | ++ version = soversion |
| 62 | ++ if threads and version[-len(threads):] != threads: |
| 63 | ++ version = version + threads |
| 64 | ++ pos = m.end() |
| 65 | ++ f.close() |
| 66 | ++ except: |
| 67 | ++ pass |
| 68 | ++ |
| 69 | + return lib,version |
| 70 | + |
| 71 | + def _dist_try_harder(distname,version,id): |
0 commit comments