summaryrefslogtreecommitdiffstats
path: root/src/corelib/debug_script.py
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-09-19 23:19:11 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-09-23 03:38:53 +0200
commit9965630aaf00d81c656baff5072dda9477544d97 (patch)
tree53bfb30ceaaac5d17678170f88a3081b0bab85d8 /src/corelib/debug_script.py
parentfe3e0fc6572b544b543e01ac5d158bd25390372a (diff)
lldb: Look up Qt Creator version via Info.plist instead of mdls
For some reason mdls fails to resolve the kMDItemVersion for Qt Creator in some cases, even if the Info.plist has the required version keys, and the version shows up fine in Finder. Work around it by manually reading the version from the Info.plist Fixes: QTBUG-117204 Change-Id: I60d57fb728608e139a4540fabf1006fc2681d0a7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/corelib/debug_script.py')
-rw-r--r--src/corelib/debug_script.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/corelib/debug_script.py b/src/corelib/debug_script.py
index 33b3244069..b4a58530da 100644
--- a/src/corelib/debug_script.py
+++ b/src/corelib/debug_script.py
@@ -47,14 +47,24 @@ def __lldb_init_module(debugger, session_dict):
return
versions = {}
- for install in os.popen(
- 'mdfind kMDItemCFBundleIdentifier=org.qt-project.qtcreator'
- '| while read p;'
- 'do echo $p=$(mdls "$p" -name kMDItemVersion -raw);'
- 'done'):
- install = install.strip()
- (p, v) = install.split('=')
- versions[v] = p
+ for path in os.popen('mdfind kMDItemCFBundleIdentifier=org.qt-project.qtcreator'):
+ path = path.strip()
+ file = open(os.path.join(path, 'Contents', 'Info.plist'), "rb")
+
+ import plistlib
+ plist = plistlib.load(file)
+
+ version = None
+ for key in ["CFBundleVersion", "CFBundleShortVersionString"]:
+ if key in plist:
+ version = plist[key]
+ break
+
+ if not version:
+ print(f"Could not resolve version for '{path}'. Ignoring.")
+ continue
+
+ versions[version] = path
if not len(versions):
print("Could not find Qt Creator installation. No Qt summary providers installed.")