From 5587b62fb81a95ad2fd74c6d1beb396b3503a966 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Feb 2022 14:42:57 +0100 Subject: Fix entry points for UI tools on macOS Use the app bundle path. Amends ba96669d4ad0c31b8703231a9346218c6b92df70 and 011cad7cd2cd617427e939d737676394425bdc6b. Task-number: PYSIDE-1831 Task-number: PYSIDE-1378 Task-number: PYSIDE-1252 Change-Id: Icfe5badda3d900b8bad8f58edab6447a901d07e6 Reviewed-by: Christian Tismer (cherry picked from commit 77d002b7ccf2cd8ff7844792365f317eac341c2a) Reviewed-by: Cristian Maureira-Fredes --- sources/pyside-tools/pyside_tool.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py index 5045c40c7..cb8394ceb 100644 --- a/sources/pyside-tools/pyside_tool.py +++ b/sources/pyside-tools/pyside_tool.py @@ -75,6 +75,14 @@ def qt_tool_wrapper(qt_tool, args, libexec=False): sys.exit(proc.returncode) +def ui_tool_binary(binary): + """Return the binary of a UI tool (App bundle on macOS).""" + if sys.platform != "darwin": + return binary + name = binary[0:1].upper() + binary[1:] + return f"{name}.app/Contents/MacOS/{name}" + + def lrelease(): qt_tool_wrapper("lrelease", sys.argv[1:]) @@ -92,7 +100,7 @@ def rcc(): def assistant(): - qt_tool_wrapper("assistant", sys.argv[1:]) + qt_tool_wrapper(ui_tool_binary("assistant"), sys.argv[1:]) def _append_to_path_var(var, value): @@ -136,14 +144,11 @@ def designer(): taskmenu_dir = os.fspath(pyside_dir / 'examples' / 'designer' / 'taskmenuextension') _append_to_path_var('PYSIDE_DESIGNER_PLUGINS', taskmenu_dir) - if sys.platform == "darwin": - qt_tool_wrapper("Designer.app/Contents/MacOS/Designer", sys.argv[1:]) - else: - qt_tool_wrapper("designer", sys.argv[1:]) + qt_tool_wrapper(ui_tool_binary("designer"), sys.argv[1:]) def linguist(): - qt_tool_wrapper("linguist", sys.argv[1:]) + qt_tool_wrapper(ui_tool_binary("linguist"), sys.argv[1:]) def genpyi(): -- cgit v1.2.3