aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-07-07 11:29:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-07-07 18:37:32 +0200
commit011cad7cd2cd617427e939d737676394425bdc6b (patch)
tree4e8e80481c31bdce0a1a34ec869bf4009fd9099e
parent2cce79b0267570642c719598388db9960b0fe953 (diff)
PySide6: Add entry points for the Qt Linguist tools
Add lupdate, lrelease, linguist. Rewrite sources/pyside-tools/CMakeLists.txt to use lists in case further tools need to be added. [ChangeLog][PySide6] pyside6-lupdate and the related tools from Qt Linguist have been re-added, enabling using the Qt translation system. Fixes: PYSIDE-1252 Change-Id: Ia528623f2b4fc3882a18347ed862ed910501d466 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--build_scripts/config.py4
-rw-r--r--build_scripts/platforms/unix.py6
-rw-r--r--build_scripts/platforms/windows_desktop.py5
-rw-r--r--sources/pyside-tools/CMakeLists.txt79
-rw-r--r--sources/pyside-tools/pyside_tool.py12
5 files changed, 48 insertions, 58 deletions
diff --git a/build_scripts/config.py b/build_scripts/config.py
index 60e9eccfb..ba89d04bd 100644
--- a/build_scripts/config.py
+++ b/build_scripts/config.py
@@ -218,7 +218,9 @@ class Config(object):
f'{PYSIDE}-rcc = {package_name}.scripts.pyside_tool:rcc',
f'{PYSIDE}-assistant = {package_name}.scripts.pyside_tool:assistant',
f'{PYSIDE}-designer= {package_name}.scripts.pyside_tool:designer',
- f'{PYSIDE}-lupdate = {package_name}.scripts.pyside_tool:main',
+ f'{PYSIDE}-linguist = {package_name}.scripts.pyside_tool:linguist',
+ f'{PYSIDE}-lupdate = {package_name}.scripts.pyside_tool:lupdate',
+ f'{PYSIDE}-lrelease = {package_name}.scripts.pyside_tool:lrelease',
f'{PYSIDE}-genpyi = {package_name}.scripts.pyside_tool:genpyi',
]
}
diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py
index 4b3ed0db0..8e5a5d584 100644
--- a/build_scripts/platforms/unix.py
+++ b/build_scripts/platforms/unix.py
@@ -165,9 +165,15 @@ def prepare_packages_posix(self, vars):
lib_exec_filters = []
if not OPTION['NO_QT_TOOLS']:
lib_exec_filters.extend(['uic', 'rcc'])
+ executables.extend(copydir(
+ "{install_dir}/bin/",
+ "{st_build_dir}/{st_package_name}",
+ filter=["lrelease", "lupdate"],
+ recursive=False, vars=vars))
# Copying assistant/designer
executables.extend(_copy_gui_executable('assistant', vars=vars))
executables.extend(_copy_gui_executable('designer', vars=vars))
+ executables.extend(_copy_gui_executable('linguist', vars=vars))
# Copy libexec
built_modules = self.get_built_pyside_config(vars)['built_modules']
diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py
index 6b60aa753..70c2fbfb6 100644
--- a/build_scripts/platforms/windows_desktop.py
+++ b/build_scripts/platforms/windows_desktop.py
@@ -160,8 +160,9 @@ def prepare_packages_win32(self, vars):
# <install>/bin/*.exe,*.dll -> {st_package_name}/
filters = ["pyside*.exe", "pyside*.dll"]
if not OPTION['NO_QT_TOOLS']:
- filters.extend(["uic.exe", "rcc.exe", "assistant.exe",
- "designer.exe"])
+ filters.extend(["lrelease.exe", "lupdate.exe", "uic.exe",
+ "rcc.exe", "assistant.exe", "designer.exe",
+ "linguist.exe"])
copydir(
"{install_dir}/bin/",
"{st_build_dir}/{st_package_name}",
diff --git a/sources/pyside-tools/CMakeLists.txt b/sources/pyside-tools/CMakeLists.txt
index 8ff6de3a8..75f5f8e77 100644
--- a/sources/pyside-tools/CMakeLists.txt
+++ b/sources/pyside-tools/CMakeLists.txt
@@ -8,76 +8,45 @@ endif()
find_package(Qt6 COMPONENTS Core HostInfo)
+set(files ${CMAKE_CURRENT_SOURCE_DIR}/pyside_tool.py)
+set(directories)
+
if(NOT NO_QT_TOOLS STREQUAL "yes")
set(TOOLS_PATH "${QT6_INSTALL_PREFIX}/${QT6_HOST_INFO_BINDIR}")
set(LIBEXEC_PATH "${QT6_INSTALL_PREFIX}/${QT6_HOST_INFO_LIBEXECDIR}")
- set(UIC_PATH "${LIBEXEC_PATH}/uic${CMAKE_EXECUTABLE_SUFFIX}")
- set(RCC_PATH "${LIBEXEC_PATH}/rcc${CMAKE_EXECUTABLE_SUFFIX}")
+ list(APPEND files "${LIBEXEC_PATH}/uic${CMAKE_EXECUTABLE_SUFFIX}"
+ "${LIBEXEC_PATH}/rcc${CMAKE_EXECUTABLE_SUFFIX}"
+ "${TOOLS_PATH}/lrelease${CMAKE_EXECUTABLE_SUFFIX}"
+ "${TOOLS_PATH}/lupdate${CMAKE_EXECUTABLE_SUFFIX}")
+
if (APPLE)
- set(ASSISTANT_PATH "${TOOLS_PATH}/Assistant.app")
- set(DESIGNER_PATH "${TOOLS_PATH}/Designer.app")
+ list(APPEND directories "${TOOLS_PATH}/Assistant.app"
+ "${TOOLS_PATH}/Designer.app"
+ "${TOOLS_PATH}/Linguist.app")
else()
- set(ASSISTANT_PATH "${TOOLS_PATH}/assistant${CMAKE_EXECUTABLE_SUFFIX}")
- set(DESIGNER_PATH "${TOOLS_PATH}/designer${CMAKE_EXECUTABLE_SUFFIX}")
+ list(APPEND files "${TOOLS_PATH}/assistant${CMAKE_EXECUTABLE_SUFFIX}"
+ "${TOOLS_PATH}/designer${CMAKE_EXECUTABLE_SUFFIX}"
+ "${TOOLS_PATH}/linguist${CMAKE_EXECUTABLE_SUFFIX}")
endif()
+endif()
- install(FILES "${UIC_PATH}"
+# pyside6-rcc, pyside6-uic, pyside6-designer, shiboken and pyside6-lupdate entrypoints
+
+foreach(file ${files})
+ install(FILES "${file}"
DESTINATION bin
PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ)
+endforeach()
- install(FILES "${RCC_PATH}"
+foreach(directory ${directories})
+ install(DIRECTORY "${directory}"
DESTINATION bin
- PERMISSIONS
+ FILE_PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ)
-
- if (EXISTS ${ASSISTANT_PATH})
- if (APPLE)
- install(DIRECTORY "${ASSISTANT_PATH}"
- DESTINATION bin
- FILE_PERMISSIONS
- OWNER_EXECUTE OWNER_WRITE OWNER_READ
- GROUP_EXECUTE GROUP_READ
- WORLD_EXECUTE WORLD_READ)
- else()
- install(FILES "${ASSISTANT_PATH}"
- DESTINATION bin
- PERMISSIONS
- OWNER_EXECUTE OWNER_WRITE OWNER_READ
- GROUP_EXECUTE GROUP_READ
- WORLD_EXECUTE WORLD_READ)
- endif()
- endif()
-
- if (EXISTS ${DESIGNER_PATH})
- if (APPLE)
- install(DIRECTORY "${DESIGNER_PATH}"
- DESTINATION bin
- FILE_PERMISSIONS
- OWNER_EXECUTE OWNER_WRITE OWNER_READ
- GROUP_EXECUTE GROUP_READ
- WORLD_EXECUTE WORLD_READ)
- else()
- install(FILES "${DESIGNER_PATH}"
- DESTINATION bin
- PERMISSIONS
- OWNER_EXECUTE OWNER_WRITE OWNER_READ
- GROUP_EXECUTE GROUP_READ
- WORLD_EXECUTE WORLD_READ)
- endif()
- endif()
-
-endif()
-
-# pyside6-rcc, pyside6-uic, pyside6-designer, shiboken and pyside6-lupdate entrypoints
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pyside_tool.py
- DESTINATION bin
- PERMISSIONS
- OWNER_EXECUTE OWNER_WRITE OWNER_READ
- GROUP_EXECUTE GROUP_READ
- WORLD_EXECUTE WORLD_READ)
+endforeach()
diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py
index dd6a5bd21..5045c40c7 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 lrelease():
+ qt_tool_wrapper("lrelease", sys.argv[1:])
+
+
+def lupdate():
+ qt_tool_wrapper("lupdate", sys.argv[1:])
+
+
def uic():
qt_tool_wrapper("uic", ['-g', 'python'] + sys.argv[1:], True)
@@ -134,6 +142,10 @@ def designer():
qt_tool_wrapper("designer", sys.argv[1:])
+def linguist():
+ qt_tool_wrapper("linguist", sys.argv[1:])
+
+
def genpyi():
pyside_dir = Path(__file__).resolve().parents[1]
support = pyside_dir / "support"