summaryrefslogtreecommitdiffstats
path: root/src/corelib/debug_script.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/debug_script.py')
-rw-r--r--src/corelib/debug_script.py71
1 files changed, 25 insertions, 46 deletions
diff --git a/src/corelib/debug_script.py b/src/corelib/debug_script.py
index c66549ceaa..b4a58530da 100644
--- a/src/corelib/debug_script.py
+++ b/src/corelib/debug_script.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2017 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the QtCore module of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2017 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -59,10 +34,6 @@ def import_bridge(path, debugger, session_dict, reload_module=False):
return bridge
-def report_success(bridge):
- print("Using Qt summary providers from Creator {} in '{}'".format(
- bridge.CREATOR_VERSION, bridge.CREATOR_PATH))
-
def __lldb_init_module(debugger, session_dict):
# Check if the module has already been imported globally. This ensures
# that the Qt Creator application search is only performed once per
@@ -73,28 +44,36 @@ def __lldb_init_module(debugger, session_dict):
bridge = import_bridge(module.__file__, debugger, session_dict,
reload_module = True)
if bridge:
- report_success(bridge)
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.")
+ return
for version in sorted(versions, key=LooseVersion, reverse=True):
path = versions[version]
-
+ print(f"Loading Qt summary providers from Creator {version} in '{path}'")
bridge_path = '{}/Contents/Resources/debugger/lldbbridge.py'.format(path)
bridge = import_bridge(bridge_path, debugger, session_dict)
if bridge:
- bridge.CREATOR_VERSION = version
- bridge.CREATOR_PATH = path
- report_success(bridge)
return
-
- print("Could not find Qt Creator installation, no Qt summary providers installed")