From d6df95d6737462bfcac1ece04070dc302aebf710 Mon Sep 17 00:00:00 2001 From: pome-ta Date: Tue, 2 May 2023 00:42:46 +0900 Subject: [PATCH 1/3] bugfix: plistlib.loads plistlib.readPlist -> plistlib.loads add read_bytes of from pathlib import Path --- scripts/sysinfo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/sysinfo.py b/scripts/sysinfo.py index 73bc52d..ba7dca6 100644 --- a/scripts/sysinfo.py +++ b/scripts/sysinfo.py @@ -2,6 +2,7 @@ import os import sys import platform +from pathlib import Path from objc_util import ObjCClass, on_main_thread import clipboard @@ -12,7 +13,8 @@ def get_pythonista_version_info(): try: plist_path = os.path.abspath(os.path.join(sys.executable, '..', 'Info.plist')) - plist = plistlib.readPlist(plist_path) + plist_data = Path(plist_path).read_bytes() + plist = plistlib.loads(plist_data) version = plist['CFBundleShortVersionString'] bundle_version = plist['CFBundleVersion'] From ec24ad8dd7450143aa56bd232751a56ce58c497d Mon Sep 17 00:00:00 2001 From: pome-ta <53405097+pome-ta@users.noreply.github.com> Date: Tue, 2 May 2023 10:35:04 +0900 Subject: [PATCH 2/3] Go all-in on pathlib --- scripts/sysinfo.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/sysinfo.py b/scripts/sysinfo.py index ba7dca6..ee12ebb 100644 --- a/scripts/sysinfo.py +++ b/scripts/sysinfo.py @@ -1,5 +1,4 @@ import plistlib -import os import sys import platform from pathlib import Path @@ -12,10 +11,8 @@ def get_pythonista_version_info(): bundle_version = None try: - plist_path = os.path.abspath(os.path.join(sys.executable, '..', 'Info.plist')) - plist_data = Path(plist_path).read_bytes() - plist = plistlib.loads(plist_data) - + info_plist = plistlib.loads((Path(sys.executable).parent / + 'Info.plist').read_bytes()) version = plist['CFBundleShortVersionString'] bundle_version = plist['CFBundleVersion'] From a71f89e843727cadb907b5662f4f99b43539753d Mon Sep 17 00:00:00 2001 From: pome-ta <53405097+pome-ta@users.noreply.github.com> Date: Tue, 2 May 2023 10:42:44 +0900 Subject: [PATCH 3/3] info_plist -> plist --- scripts/sysinfo.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/sysinfo.py b/scripts/sysinfo.py index ee12ebb..5cfe351 100644 --- a/scripts/sysinfo.py +++ b/scripts/sysinfo.py @@ -11,8 +11,7 @@ def get_pythonista_version_info(): bundle_version = None try: - info_plist = plistlib.loads((Path(sys.executable).parent / - 'Info.plist').read_bytes()) + plist = plistlib.loads((Path(sys.executable).parent / 'Info.plist').read_bytes()) version = plist['CFBundleShortVersionString'] bundle_version = plist['CFBundleVersion']