1/^def find_file(/i 2def macosx_sdk_root(): 3 sdkroot = os.environ.get('SDKROOT') 4 if sdkroot is not None: 5 return sdkroot 6 return '/' 7 8def is_macosx_sdk_path(path): 9 return (path.startswith('/usr/') and not path.startswith('/usr/local')) or path.startswith('/System/') 10 11. 12/# Check the standard locations$/i 13 if sys.platform == 'darwin': 14 sysroot = macosx_sdk_root() 15 16. 17/f = os\.path\.join(/a 18 if sys.platform == 'darwin' and is_macosx_sdk_path(dir): 19 f = os.path.join(sysroot, dir[1:], filename) 20. 21/f = os\.path\.join(/a 22 if sys.platform == 'darwin' and is_macosx_sdk_path(dir): 23 dir = os.path.join(sysroot, dir[1:]) 24 f = os.path.join(dir, filename) 25. 26/# Check whether the found file is in one of the standard directories$/i 27 if sys.platform == 'darwin': 28 sysroot = macosx_sdk_root() 29 30. 31/p = p\.rstrip(os\.sep)/a 32 if sys.platform == 'darwin' and is_macosx_sdk_path(p): 33 if os.path.join(sysroot, p[1:]) == dirname: 34 return [ ] 35. 36/p = p\.rstrip(os\.sep)/a 37 if sys.platform == 'darwin' and is_macosx_sdk_path(p): 38 sp = os.path.join(sysroot, p[1:]) 39 if sp == dirname: 40 return [ sp ] 41. 42g/('-Wl,-search_paths_first',)/s//()/ 43/readline_extra_link_args/a 44. 45?darwin?,.+1d 46s/ // 47g/'-framework', 'Carbon'/s//&, '-no64'/ 48/carbon_kwds =/s/carbon_extra_compile_args/& + ['-no64']/ 49/extra_compile_args=carbon_extra_compile_args/s//& + ['-no64']/ 50/# readline$/a 51. 52/if platform == 'darwin':/a 53. 54.,/if do_readline:/-1s/^/#/ 55/name = os\.path\.join(ssl_inc_dir, 'openssl', 'opensslv\.h')$/i 56 if sys.platform == 'darwin' and is_macosx_sdk_path(ssl_inc_dir): 57 ssl_inc_dir = os.path.join(macosx_sdk_root(), ssl_inc_dir[1:]) 58. 59/f = os\.path\.join(d, "sqlite3\.h")$/i 60 if sys.platform == 'darwin' and is_macosx_sdk_path(d): 61 d = os.path.join(macosx_sdk_root(), d[1:]) 62. 63/f = "\/usr\/include\/db\.h"$/a 64 if sys.platform == 'darwin' and is_macosx_sdk_path(f): 65 f = os.path.join(macosx_sdk_root(), f[1:]) 66. 67/\[expatinc]/d 68/expat\/xmlparse.c/a 69. 70.,/]/-1d 71a 72 libraries = ['expat'] 73. 74w 75