Skip to content

Commit 5f7ed75

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 c13d7de commit 5f7ed75

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎mesonbuild/dependencies/blas_lapack.py‎

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

482482
def check_macOS_recent_enough(self) -> bool:
483-
# We need the SDK to be >=13.3 (meaning at least XCode 14.3)
484-
cmd = ['xcrun', '-sdk', 'macosx', '--show-sdk-version']
485-
sdk_version = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
486483
macos_version = platform.mac_ver()[0]
487484
deploy_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', macos_version)
488-
return sdk_version >= '13.3' and deploy_target >= '13.3'
485+
if not mesonlib.version_compare(deploy_target, '>=13.3'):
486+
return False
487+
488+
# We also need the SDK to be >=13.3 (meaning at least XCode 14.3)
489+
cmd = ['xcrun', '-sdk', 'macosx', '--show-sdk-version']
490+
sdk_version = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
491+
return mesonlib.version_compare(sdk_version, '>=13.3')
489492

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

0 commit comments

Comments
 (0)