Skip to content

Commit d80dadb

Browse files
committed
BUG: fix macOS version checks so things work in very old versions
The two things fixed here: - `xcrun` isn't available on very old versions (MacPorts still supports 10.5/10.6) - Version comparison is done correctly now with `mesonlib.version_compare` See numpy/numpy#25406 for the bug report.
1 parent 708d528 commit d80dadb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mesonbuild/dependencies/blas_lapack.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,15 @@ def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.
742742
self.detect(kwargs)
743743

744744
def check_macOS_recent_enough(self) -> bool:
745-
# We need the SDK to be >=13.3 (meaning at least XCode 14.3)
746-
cmd = ['xcrun', '-sdk', 'macosx', '--show-sdk-version']
747-
sdk_version = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
748745
macos_version = platform.mac_ver()[0]
749746
deploy_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', macos_version)
750-
return sdk_version >= '13.3' and deploy_target >= '13.3'
747+
if not mesonlib.version_compare(deploy_target, '>=13.3'):
748+
return False
749+
750+
# We also need the SDK to be >=13.3 (meaning at least XCode 14.3)
751+
cmd = ['xcrun', '-sdk', 'macosx', '--show-sdk-version']
752+
sdk_version = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
753+
return mesonlib.version_compare(sdk_version, '>=13.3')
751754

752755
def detect(self, kwargs: T.Dict[str, T.Any]) -> None:
753756
from .framework import ExtraFrameworkDependency

0 commit comments

Comments
 (0)