Remove references to any SDKs not available
(_config_vars)
| 329 | |
| 330 | |
| 331 | def _check_for_unavailable_sdk(_config_vars): |
| 332 | """Remove references to any SDKs not available""" |
| 333 | # If we're on OSX 10.5 or later and the user tries to |
| 334 | # compile an extension using an SDK that is not present |
| 335 | # on the current machine it is better to not use an SDK |
| 336 | # than to fail. This is particularly important with |
| 337 | # the standalone Command Line Tools alternative to a |
| 338 | # full-blown Xcode install since the CLT packages do not |
| 339 | # provide SDKs. If the SDK is not present, it is assumed |
| 340 | # that the header files and dev libs have been installed |
| 341 | # to /usr and /System/Library by either a standalone CLT |
| 342 | # package or the CLT component within Xcode. |
| 343 | cflags = _config_vars.get('CFLAGS', '') |
| 344 | m = re.search(r'-isysroot\s*(\S+)', cflags) |
| 345 | if m is not None: |
| 346 | sdk = m.group(1) |
| 347 | if not os.path.exists(sdk): |
| 348 | for cv in _UNIVERSAL_CONFIG_VARS: |
| 349 | # Do not alter a config var explicitly overridden by env var |
| 350 | if cv in _config_vars and cv not in os.environ: |
| 351 | flags = _config_vars[cv] |
| 352 | flags = re.sub(r'-isysroot\s*\S+(?:\s|$)', ' ', flags) |
| 353 | _save_modified_value(_config_vars, cv, flags) |
| 354 | |
| 355 | return _config_vars |
| 356 | |
| 357 | |
| 358 | def compiler_fixup(compiler_so, cc_args): |
no test coverage detected