From 9e342590eff1150aa9d4400b7fd1f1c579be4f99 Mon Sep 17 00:00:00 2001 From: Florian Weikert Date: Tue, 7 Feb 2023 16:32:36 +0100 Subject: [PATCH] Fix MacOS version detection (#1546) https://github.com/bazelbuild/continuous-integration/pull/1542 relied on platform.mac_ver() to detect the MacOS version, which did not work as expected. Consequently, the previous PR led the CI to activate an incorrect version of Xcode. This behavior has been fixed by this change. Related to #1431. Users can still request a specific Xcode version in their CI config. --- buildkite/bazelci.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py index c2b97b220a..1d42acb134 100755 --- a/buildkite/bazelci.py +++ b/buildkite/bazelci.py @@ -1439,7 +1439,8 @@ def execute_commands( def get_default_xcode_version(): - macos, _, _ = platform_module.mac_ver() + # Cannot use platform.mac_ver() since it returns 10.16 on both 12.x and 13.x + macos = execute_command_and_get_output(["sw_vers", "-productVersion"], print_output=False) major = int(macos.split(".")[0]) return DEFAULT_XCODE_VERSION_PER_OS.get(major, "13.0") # we use 13.0 due to legacy reasons