(dll_name)
| 254 | d.write('%s\n' % s[1]) |
| 255 | |
| 256 | def find_dll(dll_name): |
| 257 | |
| 258 | arch = {'AMD64' : 'amd64', |
| 259 | 'Intel' : 'x86'}[get_build_architecture()] |
| 260 | |
| 261 | def _find_dll_in_winsxs(dll_name): |
| 262 | # Walk through the WinSxS directory to find the dll. |
| 263 | winsxs_path = os.path.join(os.environ.get('WINDIR', r'C:\WINDOWS'), |
| 264 | 'winsxs') |
| 265 | if not os.path.exists(winsxs_path): |
| 266 | return None |
| 267 | for root, dirs, files in os.walk(winsxs_path): |
| 268 | if dll_name in files and arch in root: |
| 269 | return os.path.join(root, dll_name) |
| 270 | return None |
| 271 | |
| 272 | def _find_dll_in_path(dll_name): |
| 273 | # First, look in the Python directory, then scan PATH for |
| 274 | # the given dll name. |
| 275 | for path in [sys.prefix] + os.environ['PATH'].split(';'): |
| 276 | filepath = os.path.join(path, dll_name) |
| 277 | if os.path.exists(filepath): |
| 278 | return os.path.abspath(filepath) |
| 279 | |
| 280 | return _find_dll_in_winsxs(dll_name) or _find_dll_in_path(dll_name) |
| 281 | |
| 282 | def build_msvcr_library(debug=False): |
| 283 | if os.name != 'nt': |
no test coverage detected