From 18885917a756bd37ee8e5e7fa35a5ed862485cbe Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 29 Oct 2023 11:15:44 -0500 Subject: meson: do the macos sdk version comparison in meson Since we can no longer rely on distuils for a version comparison, let's modify the macos-sdk-version script so it returns multiple potential versions to meson. Then use meson's built-in version comparison to pick the right one instead. This avoids the complication of needing certain python packages installed since everything simply uses stdlib functions. --- TOOLS/macos-sdk-version.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'TOOLS') diff --git a/TOOLS/macos-sdk-version.py b/TOOLS/macos-sdk-version.py index ae1d355539..fc800fb67e 100755 --- a/TOOLS/macos-sdk-version.py +++ b/TOOLS/macos-sdk-version.py @@ -1,24 +1,23 @@ #!/usr/bin/env python3 -# Logic copied from compiler_swift.py in the waf build. This checks for the sdk -# path, the sdk version, and the sdk build version. The sdk path is returned -# along with what is selected as the sdk version. +# This checks for the sdk path, the sdk version, and +# the sdk build version. import re import os import string import sys -from packaging import version from shutil import which from subprocess import check_output def find_macos_sdk(): sdk = os.environ.get('MACOS_SDK', '') sdk_version = os.environ.get('MACOS_SDK_VERSION', '0.0') + build_version = '0.0' xcrun = which('xcrun') if not xcrun: - return sdk,sdk_version + return sdk,sdk_version,build_version if not sdk: sdk = check_output([xcrun, '--sdk', 'macosx', '--show-sdk-path'], @@ -55,13 +54,7 @@ def find_macos_sdk(): if not isinstance(sdk_version, str): sdk_version = '10.10.0' - # pick the higher version, always pick sdk over build if newer - if version.parse(build_version) > version.parse(sdk_version): - return sdk,build_version - else: - return sdk,sdk_version - - return sdk,sdk_version + return sdk,sdk_version,build_version if __name__ == "__main__": sdk_info = find_macos_sdk() -- cgit v1.2.3