Returns the default SDKROOT to use. Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode project, then the environment variable was empty. Starting with this version, Xcode uses the name of the newest SDK installed.
(self)
| 1337 | return items |
| 1338 | |
| 1339 | def _DefaultSdkRoot(self): |
| 1340 | """Returns the default SDKROOT to use. |
| 1341 | |
| 1342 | Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode |
| 1343 | project, then the environment variable was empty. Starting with this |
| 1344 | version, Xcode uses the name of the newest SDK installed. |
| 1345 | """ |
| 1346 | xcode_version, _ = XcodeVersion() |
| 1347 | if xcode_version < "0500": |
| 1348 | return "" |
| 1349 | default_sdk_path = self._XcodeSdkPath("") |
| 1350 | if default_sdk_root := XcodeSettings._sdk_root_cache.get(default_sdk_path): |
| 1351 | return default_sdk_root |
| 1352 | try: |
| 1353 | all_sdks = GetStdout(["xcodebuild", "-showsdks"]) |
| 1354 | except (GypError, OSError): |
| 1355 | # If xcodebuild fails, there will be no valid SDKs |
| 1356 | return "" |
| 1357 | for line in all_sdks.splitlines(): |
| 1358 | items = line.split() |
| 1359 | if len(items) >= 3 and items[-2] == "-sdk": |
| 1360 | sdk_root = items[-1] |
| 1361 | sdk_path = self._XcodeSdkPath(sdk_root) |
| 1362 | if sdk_path == default_sdk_path: |
| 1363 | return sdk_root |
| 1364 | return "" |
| 1365 | |
| 1366 | |
| 1367 | class MacPrefixHeader: |
no test coverage detected