From a0ac312f52d9af26214c5d9c712bdbc07b15deaf Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Tue, 16 Apr 2024 15:06:27 +0800 Subject: [PATCH] Fix obsolete Python API --- pyobjc-core/Lib/PyObjCTools/TestSupport.py | 12 ++++----- pyobjc-core/Tools/pyobjc_setup.py | 12 ++++++--- pyobjc-core/setup.py | 25 ++++++++++++++----- pyobjc-framework-AVFoundation/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-AVKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Accounts/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-AdSupport/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-AddressBook/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Automator/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-BusinessChat/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CFNetwork/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CloudKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Cocoa/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-ColorSync/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Contacts/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-ContactsUI/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreAudio/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreAudioKit/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreData/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreHaptics/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreLocation/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreML/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreMedia/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreMediaIO/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreMotion/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreServices/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreText/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-CoreWLAN/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-DVDPlayback/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-DeviceCheck/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-EventKit/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-FSEvents/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-FileProvider/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-FinderSync/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-GameCenter/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-GameKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-GameplayKit/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-IOSurface/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Intents/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-MapKit/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-MediaLibrary/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-MediaPlayer/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-MediaToolbox/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Message/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Metal/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-MetalKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-ModelIO/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-NetFS/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Network/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-OSAKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-OSLog/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-PencilKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Photos/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-PhotosUI/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-PubSub/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-PushKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-QTKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Quartz/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-SceneKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-ScreenSaver/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-SearchKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Security/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Social/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Speech/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-SpriteKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-StoreKit/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-SyncServices/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-VideoToolbox/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-Vision/pyobjc_setup.py | 12 ++++++--- pyobjc-framework-WebKit/pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- .../pyobjc_setup.py | 12 ++++++--- pyobjc-framework-libdispatch/pyobjc_setup.py | 12 ++++++--- 121 files changed, 1095 insertions(+), 370 deletions(-) diff --git pyobjc-core/Lib/PyObjCTools/TestSupport.py pyobjc-core/Lib/PyObjCTools/TestSupport.py index 5699e3576..5a946861e 100644 --- pyobjc-core/Lib/PyObjCTools/TestSupport.py +++ pyobjc-core/Lib/PyObjCTools/TestSupport.py @@ -175,13 +175,11 @@ def os_release(): if _os_release is not None: return _os_release - if hasattr(_pl, "load"): - with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as fp: - pl = _pl.load(fp) - else: - pl = _pl.readPlist("/System/Library/CoreServices/SystemVersion.plist") - v = pl["ProductVersion"] - return ".".join(v.split(".")) + _os_release = ( + _subprocess.check_output(["sw_vers", "-productVersion"]).decode().strip() + ) + + return _os_release def is32Bit(): diff --git pyobjc-core/Tools/pyobjc_setup.py pyobjc-core/Tools/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-core/Tools/pyobjc_setup.py +++ pyobjc-core/Tools/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-core/setup.py pyobjc-core/setup.py index 95730a2b8..e0e50e1ed 100644 --- pyobjc-core/setup.py +++ pyobjc-core/setup.py @@ -38,7 +38,8 @@ if sys.version_info < MIN_PYTHON: def get_os_level(): - pl = plistlib.readPlist("/System/Library/CoreServices/SystemVersion.plist") + with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as fp: + pl = plistlib.load(fp) v = pl["ProductVersion"] return ".".join(v.split(".")[:2]) @@ -47,11 +48,23 @@ def get_sdk_level(sdk): if sdk == "/": return get_os_level() - sdk = os.path.basename(sdk) - assert sdk.startswith("MacOSX") - assert sdk.endswith(".sdk") - sdk = sdk[6:-4] - return sdk + sdk = sdk.rstrip("/") + sdkname = os.path.basename(sdk) + assert sdkname.startswith("MacOSX") + assert sdkname.endswith(".sdk") + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): + try: + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) + return pl["Version"] + except Exception: + raise SystemExit("Cannot determine SDK version") + else: + version_part = sdkname[6:-4] + assert version_part + return version_part # CFLAGS for the objc._objc extension: diff --git pyobjc-framework-AVFoundation/pyobjc_setup.py pyobjc-framework-AVFoundation/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AVFoundation/pyobjc_setup.py +++ pyobjc-framework-AVFoundation/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AVKit/pyobjc_setup.py pyobjc-framework-AVKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AVKit/pyobjc_setup.py +++ pyobjc-framework-AVKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Accounts/pyobjc_setup.py pyobjc-framework-Accounts/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Accounts/pyobjc_setup.py +++ pyobjc-framework-Accounts/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AdSupport/pyobjc_setup.py pyobjc-framework-AdSupport/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AdSupport/pyobjc_setup.py +++ pyobjc-framework-AdSupport/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AddressBook/pyobjc_setup.py pyobjc-framework-AddressBook/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AddressBook/pyobjc_setup.py +++ pyobjc-framework-AddressBook/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AppleScriptKit/pyobjc_setup.py pyobjc-framework-AppleScriptKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AppleScriptKit/pyobjc_setup.py +++ pyobjc-framework-AppleScriptKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AppleScriptObjC/pyobjc_setup.py pyobjc-framework-AppleScriptObjC/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AppleScriptObjC/pyobjc_setup.py +++ pyobjc-framework-AppleScriptObjC/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ApplicationServices/pyobjc_setup.py pyobjc-framework-ApplicationServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ApplicationServices/pyobjc_setup.py +++ pyobjc-framework-ApplicationServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AuthenticationServices/pyobjc_setup.py pyobjc-framework-AuthenticationServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AuthenticationServices/pyobjc_setup.py +++ pyobjc-framework-AuthenticationServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-AutomaticAssessmentConfiguration/pyobjc_setup.py pyobjc-framework-AutomaticAssessmentConfiguration/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-AutomaticAssessmentConfiguration/pyobjc_setup.py +++ pyobjc-framework-AutomaticAssessmentConfiguration/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Automator/pyobjc_setup.py pyobjc-framework-Automator/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Automator/pyobjc_setup.py +++ pyobjc-framework-Automator/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-BusinessChat/pyobjc_setup.py pyobjc-framework-BusinessChat/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-BusinessChat/pyobjc_setup.py +++ pyobjc-framework-BusinessChat/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CFNetwork/pyobjc_setup.py pyobjc-framework-CFNetwork/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CFNetwork/pyobjc_setup.py +++ pyobjc-framework-CFNetwork/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CalendarStore/pyobjc_setup.py pyobjc-framework-CalendarStore/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CalendarStore/pyobjc_setup.py +++ pyobjc-framework-CalendarStore/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CloudKit/pyobjc_setup.py pyobjc-framework-CloudKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CloudKit/pyobjc_setup.py +++ pyobjc-framework-CloudKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Cocoa/pyobjc_setup.py pyobjc-framework-Cocoa/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Cocoa/pyobjc_setup.py +++ pyobjc-framework-Cocoa/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Collaboration/pyobjc_setup.py pyobjc-framework-Collaboration/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Collaboration/pyobjc_setup.py +++ pyobjc-framework-Collaboration/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ColorSync/pyobjc_setup.py pyobjc-framework-ColorSync/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ColorSync/pyobjc_setup.py +++ pyobjc-framework-ColorSync/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Contacts/pyobjc_setup.py pyobjc-framework-Contacts/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Contacts/pyobjc_setup.py +++ pyobjc-framework-Contacts/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ContactsUI/pyobjc_setup.py pyobjc-framework-ContactsUI/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ContactsUI/pyobjc_setup.py +++ pyobjc-framework-ContactsUI/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreAudio/pyobjc_setup.py pyobjc-framework-CoreAudio/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreAudio/pyobjc_setup.py +++ pyobjc-framework-CoreAudio/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreAudioKit/pyobjc_setup.py pyobjc-framework-CoreAudioKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreAudioKit/pyobjc_setup.py +++ pyobjc-framework-CoreAudioKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreBluetooth/pyobjc_setup.py pyobjc-framework-CoreBluetooth/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreBluetooth/pyobjc_setup.py +++ pyobjc-framework-CoreBluetooth/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreData/pyobjc_setup.py pyobjc-framework-CoreData/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreData/pyobjc_setup.py +++ pyobjc-framework-CoreData/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreHaptics/pyobjc_setup.py pyobjc-framework-CoreHaptics/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreHaptics/pyobjc_setup.py +++ pyobjc-framework-CoreHaptics/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreLocation/pyobjc_setup.py pyobjc-framework-CoreLocation/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreLocation/pyobjc_setup.py +++ pyobjc-framework-CoreLocation/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreML/pyobjc_setup.py pyobjc-framework-CoreML/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreML/pyobjc_setup.py +++ pyobjc-framework-CoreML/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreMedia/pyobjc_setup.py pyobjc-framework-CoreMedia/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreMedia/pyobjc_setup.py +++ pyobjc-framework-CoreMedia/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreMediaIO/pyobjc_setup.py pyobjc-framework-CoreMediaIO/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreMediaIO/pyobjc_setup.py +++ pyobjc-framework-CoreMediaIO/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreMotion/pyobjc_setup.py pyobjc-framework-CoreMotion/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreMotion/pyobjc_setup.py +++ pyobjc-framework-CoreMotion/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreServices/pyobjc_setup.py pyobjc-framework-CoreServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreServices/pyobjc_setup.py +++ pyobjc-framework-CoreServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreSpotlight/pyobjc_setup.py pyobjc-framework-CoreSpotlight/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreSpotlight/pyobjc_setup.py +++ pyobjc-framework-CoreSpotlight/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreText/pyobjc_setup.py pyobjc-framework-CoreText/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreText/pyobjc_setup.py +++ pyobjc-framework-CoreText/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CoreWLAN/pyobjc_setup.py pyobjc-framework-CoreWLAN/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CoreWLAN/pyobjc_setup.py +++ pyobjc-framework-CoreWLAN/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-CryptoTokenKit/pyobjc_setup.py pyobjc-framework-CryptoTokenKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-CryptoTokenKit/pyobjc_setup.py +++ pyobjc-framework-CryptoTokenKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-DVDPlayback/pyobjc_setup.py pyobjc-framework-DVDPlayback/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-DVDPlayback/pyobjc_setup.py +++ pyobjc-framework-DVDPlayback/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-DeviceCheck/pyobjc_setup.py pyobjc-framework-DeviceCheck/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-DeviceCheck/pyobjc_setup.py +++ pyobjc-framework-DeviceCheck/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-DictionaryServices/pyobjc_setup.py pyobjc-framework-DictionaryServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-DictionaryServices/pyobjc_setup.py +++ pyobjc-framework-DictionaryServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-DiscRecording/pyobjc_setup.py pyobjc-framework-DiscRecording/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-DiscRecording/pyobjc_setup.py +++ pyobjc-framework-DiscRecording/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-DiscRecordingUI/pyobjc_setup.py pyobjc-framework-DiscRecordingUI/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-DiscRecordingUI/pyobjc_setup.py +++ pyobjc-framework-DiscRecordingUI/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-DiskArbitration/pyobjc_setup.py pyobjc-framework-DiskArbitration/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-DiskArbitration/pyobjc_setup.py +++ pyobjc-framework-DiskArbitration/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-EventKit/pyobjc_setup.py pyobjc-framework-EventKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-EventKit/pyobjc_setup.py +++ pyobjc-framework-EventKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ExceptionHandling/pyobjc_setup.py pyobjc-framework-ExceptionHandling/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ExceptionHandling/pyobjc_setup.py +++ pyobjc-framework-ExceptionHandling/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ExecutionPolicy/pyobjc_setup.py pyobjc-framework-ExecutionPolicy/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ExecutionPolicy/pyobjc_setup.py +++ pyobjc-framework-ExecutionPolicy/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ExternalAccessory/pyobjc_setup.py pyobjc-framework-ExternalAccessory/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ExternalAccessory/pyobjc_setup.py +++ pyobjc-framework-ExternalAccessory/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-FSEvents/pyobjc_setup.py pyobjc-framework-FSEvents/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-FSEvents/pyobjc_setup.py +++ pyobjc-framework-FSEvents/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-FileProvider/pyobjc_setup.py pyobjc-framework-FileProvider/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-FileProvider/pyobjc_setup.py +++ pyobjc-framework-FileProvider/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-FileProviderUI/pyobjc_setup.py pyobjc-framework-FileProviderUI/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-FileProviderUI/pyobjc_setup.py +++ pyobjc-framework-FileProviderUI/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-FinderSync/pyobjc_setup.py pyobjc-framework-FinderSync/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-FinderSync/pyobjc_setup.py +++ pyobjc-framework-FinderSync/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-GameCenter/pyobjc_setup.py pyobjc-framework-GameCenter/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-GameCenter/pyobjc_setup.py +++ pyobjc-framework-GameCenter/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-GameController/pyobjc_setup.py pyobjc-framework-GameController/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-GameController/pyobjc_setup.py +++ pyobjc-framework-GameController/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-GameKit/pyobjc_setup.py pyobjc-framework-GameKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-GameKit/pyobjc_setup.py +++ pyobjc-framework-GameKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-GameplayKit/pyobjc_setup.py pyobjc-framework-GameplayKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-GameplayKit/pyobjc_setup.py +++ pyobjc-framework-GameplayKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-IMServicePlugIn/pyobjc_setup.py pyobjc-framework-IMServicePlugIn/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-IMServicePlugIn/pyobjc_setup.py +++ pyobjc-framework-IMServicePlugIn/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-IOSurface/pyobjc_setup.py pyobjc-framework-IOSurface/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-IOSurface/pyobjc_setup.py +++ pyobjc-framework-IOSurface/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ImageCaptureCore/pyobjc_setup.py pyobjc-framework-ImageCaptureCore/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ImageCaptureCore/pyobjc_setup.py +++ pyobjc-framework-ImageCaptureCore/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-InputMethodKit/pyobjc_setup.py pyobjc-framework-InputMethodKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-InputMethodKit/pyobjc_setup.py +++ pyobjc-framework-InputMethodKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-InstallerPlugins/pyobjc_setup.py pyobjc-framework-InstallerPlugins/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-InstallerPlugins/pyobjc_setup.py +++ pyobjc-framework-InstallerPlugins/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-InstantMessage/pyobjc_setup.py pyobjc-framework-InstantMessage/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-InstantMessage/pyobjc_setup.py +++ pyobjc-framework-InstantMessage/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Intents/pyobjc_setup.py pyobjc-framework-Intents/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Intents/pyobjc_setup.py +++ pyobjc-framework-Intents/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-InterfaceBuilderKit/pyobjc_setup.py pyobjc-framework-InterfaceBuilderKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-InterfaceBuilderKit/pyobjc_setup.py +++ pyobjc-framework-InterfaceBuilderKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-LatentSemanticMapping/pyobjc_setup.py pyobjc-framework-LatentSemanticMapping/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-LatentSemanticMapping/pyobjc_setup.py +++ pyobjc-framework-LatentSemanticMapping/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-LaunchServices/pyobjc_setup.py pyobjc-framework-LaunchServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-LaunchServices/pyobjc_setup.py +++ pyobjc-framework-LaunchServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-LinkPresentation/pyobjc_setup.py pyobjc-framework-LinkPresentation/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-LinkPresentation/pyobjc_setup.py +++ pyobjc-framework-LinkPresentation/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-LocalAuthentication/pyobjc_setup.py pyobjc-framework-LocalAuthentication/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-LocalAuthentication/pyobjc_setup.py +++ pyobjc-framework-LocalAuthentication/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MapKit/pyobjc_setup.py pyobjc-framework-MapKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MapKit/pyobjc_setup.py +++ pyobjc-framework-MapKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MediaAccessibility/pyobjc_setup.py pyobjc-framework-MediaAccessibility/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MediaAccessibility/pyobjc_setup.py +++ pyobjc-framework-MediaAccessibility/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MediaLibrary/pyobjc_setup.py pyobjc-framework-MediaLibrary/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MediaLibrary/pyobjc_setup.py +++ pyobjc-framework-MediaLibrary/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MediaPlayer/pyobjc_setup.py pyobjc-framework-MediaPlayer/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MediaPlayer/pyobjc_setup.py +++ pyobjc-framework-MediaPlayer/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MediaToolbox/pyobjc_setup.py pyobjc-framework-MediaToolbox/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MediaToolbox/pyobjc_setup.py +++ pyobjc-framework-MediaToolbox/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Message/pyobjc_setup.py pyobjc-framework-Message/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Message/pyobjc_setup.py +++ pyobjc-framework-Message/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Metal/pyobjc_setup.py pyobjc-framework-Metal/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Metal/pyobjc_setup.py +++ pyobjc-framework-Metal/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MetalKit/pyobjc_setup.py pyobjc-framework-MetalKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MetalKit/pyobjc_setup.py +++ pyobjc-framework-MetalKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ModelIO/pyobjc_setup.py pyobjc-framework-ModelIO/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ModelIO/pyobjc_setup.py +++ pyobjc-framework-ModelIO/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-MultipeerConnectivity/pyobjc_setup.py pyobjc-framework-MultipeerConnectivity/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-MultipeerConnectivity/pyobjc_setup.py +++ pyobjc-framework-MultipeerConnectivity/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-NaturalLanguage/pyobjc_setup.py pyobjc-framework-NaturalLanguage/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-NaturalLanguage/pyobjc_setup.py +++ pyobjc-framework-NaturalLanguage/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-NetFS/pyobjc_setup.py pyobjc-framework-NetFS/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-NetFS/pyobjc_setup.py +++ pyobjc-framework-NetFS/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Network/pyobjc_setup.py pyobjc-framework-Network/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Network/pyobjc_setup.py +++ pyobjc-framework-Network/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-NetworkExtension/pyobjc_setup.py pyobjc-framework-NetworkExtension/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-NetworkExtension/pyobjc_setup.py +++ pyobjc-framework-NetworkExtension/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-NotificationCenter/pyobjc_setup.py pyobjc-framework-NotificationCenter/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-NotificationCenter/pyobjc_setup.py +++ pyobjc-framework-NotificationCenter/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-OSAKit/pyobjc_setup.py pyobjc-framework-OSAKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-OSAKit/pyobjc_setup.py +++ pyobjc-framework-OSAKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-OSLog/pyobjc_setup.py pyobjc-framework-OSLog/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-OSLog/pyobjc_setup.py +++ pyobjc-framework-OSLog/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-OpenDirectory/pyobjc_setup.py pyobjc-framework-OpenDirectory/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-OpenDirectory/pyobjc_setup.py +++ pyobjc-framework-OpenDirectory/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-PencilKit/pyobjc_setup.py pyobjc-framework-PencilKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-PencilKit/pyobjc_setup.py +++ pyobjc-framework-PencilKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Photos/pyobjc_setup.py pyobjc-framework-Photos/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Photos/pyobjc_setup.py +++ pyobjc-framework-Photos/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-PhotosUI/pyobjc_setup.py pyobjc-framework-PhotosUI/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-PhotosUI/pyobjc_setup.py +++ pyobjc-framework-PhotosUI/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-PreferencePanes/pyobjc_setup.py pyobjc-framework-PreferencePanes/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-PreferencePanes/pyobjc_setup.py +++ pyobjc-framework-PreferencePanes/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-PubSub/pyobjc_setup.py pyobjc-framework-PubSub/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-PubSub/pyobjc_setup.py +++ pyobjc-framework-PubSub/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-PushKit/pyobjc_setup.py pyobjc-framework-PushKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-PushKit/pyobjc_setup.py +++ pyobjc-framework-PushKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-QTKit/pyobjc_setup.py pyobjc-framework-QTKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-QTKit/pyobjc_setup.py +++ pyobjc-framework-QTKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Quartz/pyobjc_setup.py pyobjc-framework-Quartz/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Quartz/pyobjc_setup.py +++ pyobjc-framework-Quartz/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-QuickLookThumbnailing/pyobjc_setup.py pyobjc-framework-QuickLookThumbnailing/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-QuickLookThumbnailing/pyobjc_setup.py +++ pyobjc-framework-QuickLookThumbnailing/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SafariServices/pyobjc_setup.py pyobjc-framework-SafariServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SafariServices/pyobjc_setup.py +++ pyobjc-framework-SafariServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SceneKit/pyobjc_setup.py pyobjc-framework-SceneKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SceneKit/pyobjc_setup.py +++ pyobjc-framework-SceneKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ScreenSaver/pyobjc_setup.py pyobjc-framework-ScreenSaver/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ScreenSaver/pyobjc_setup.py +++ pyobjc-framework-ScreenSaver/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ScriptingBridge/pyobjc_setup.py pyobjc-framework-ScriptingBridge/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ScriptingBridge/pyobjc_setup.py +++ pyobjc-framework-ScriptingBridge/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SearchKit/pyobjc_setup.py pyobjc-framework-SearchKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SearchKit/pyobjc_setup.py +++ pyobjc-framework-SearchKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Security/pyobjc_setup.py pyobjc-framework-Security/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Security/pyobjc_setup.py +++ pyobjc-framework-Security/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SecurityFoundation/pyobjc_setup.py pyobjc-framework-SecurityFoundation/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SecurityFoundation/pyobjc_setup.py +++ pyobjc-framework-SecurityFoundation/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SecurityInterface/pyobjc_setup.py pyobjc-framework-SecurityInterface/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SecurityInterface/pyobjc_setup.py +++ pyobjc-framework-SecurityInterface/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ServerNotification/pyobjc_setup.py pyobjc-framework-ServerNotification/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ServerNotification/pyobjc_setup.py +++ pyobjc-framework-ServerNotification/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-ServiceManagement/pyobjc_setup.py pyobjc-framework-ServiceManagement/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-ServiceManagement/pyobjc_setup.py +++ pyobjc-framework-ServiceManagement/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Social/pyobjc_setup.py pyobjc-framework-Social/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Social/pyobjc_setup.py +++ pyobjc-framework-Social/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SoundAnalysis/pyobjc_setup.py pyobjc-framework-SoundAnalysis/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SoundAnalysis/pyobjc_setup.py +++ pyobjc-framework-SoundAnalysis/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Speech/pyobjc_setup.py pyobjc-framework-Speech/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Speech/pyobjc_setup.py +++ pyobjc-framework-Speech/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SpriteKit/pyobjc_setup.py pyobjc-framework-SpriteKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SpriteKit/pyobjc_setup.py +++ pyobjc-framework-SpriteKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-StoreKit/pyobjc_setup.py pyobjc-framework-StoreKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-StoreKit/pyobjc_setup.py +++ pyobjc-framework-StoreKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SyncServices/pyobjc_setup.py pyobjc-framework-SyncServices/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SyncServices/pyobjc_setup.py +++ pyobjc-framework-SyncServices/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SystemConfiguration/pyobjc_setup.py pyobjc-framework-SystemConfiguration/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SystemConfiguration/pyobjc_setup.py +++ pyobjc-framework-SystemConfiguration/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-SystemExtensions/pyobjc_setup.py pyobjc-framework-SystemExtensions/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-SystemExtensions/pyobjc_setup.py +++ pyobjc-framework-SystemExtensions/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-UserNotifications/pyobjc_setup.py pyobjc-framework-UserNotifications/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-UserNotifications/pyobjc_setup.py +++ pyobjc-framework-UserNotifications/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-VideoSubscriberAccount/pyobjc_setup.py pyobjc-framework-VideoSubscriberAccount/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-VideoSubscriberAccount/pyobjc_setup.py +++ pyobjc-framework-VideoSubscriberAccount/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-VideoToolbox/pyobjc_setup.py pyobjc-framework-VideoToolbox/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-VideoToolbox/pyobjc_setup.py +++ pyobjc-framework-VideoToolbox/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-Vision/pyobjc_setup.py pyobjc-framework-Vision/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-Vision/pyobjc_setup.py +++ pyobjc-framework-Vision/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-WebKit/pyobjc_setup.py pyobjc-framework-WebKit/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-WebKit/pyobjc_setup.py +++ pyobjc-framework-WebKit/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-XgridFoundation/pyobjc_setup.py pyobjc-framework-XgridFoundation/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-XgridFoundation/pyobjc_setup.py +++ pyobjc-framework-XgridFoundation/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-iTunesLibrary/pyobjc_setup.py pyobjc-framework-iTunesLibrary/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-iTunesLibrary/pyobjc_setup.py +++ pyobjc-framework-iTunesLibrary/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib): diff --git pyobjc-framework-libdispatch/pyobjc_setup.py pyobjc-framework-libdispatch/pyobjc_setup.py index ddc8c2c48..9e019cd14 100644 --- pyobjc-framework-libdispatch/pyobjc_setup.py +++ pyobjc-framework-libdispatch/pyobjc_setup.py @@ -229,17 +229,23 @@ def get_sdk_level(): if sdk == "/": return get_os_level() + sdk = sdk.rstrip("/") sdkname = os.path.basename(sdk) assert sdkname.startswith("MacOSX") assert sdkname.endswith(".sdk") - if sdkname == "MacOSX.sdk": + + settings_path = os.path.join(sdk, "SDKSettings.plist") + if os.path.exists(settings_path): try: - pl = plistlib.readPlist(os.path.join(sdk, "SDKSettings.plist")) + with open(os.path.join(sdk, "SDKSettings.plist"), "rb") as fp: + pl = plistlib.load(fp) return pl["Version"] except Exception: raise SystemExit("Cannot determine SDK version") else: - return sdkname[6:-4] + version_part = sdkname[6:-4] + assert version_part + return version_part class pyobjc_install_lib(install_lib.install_lib):