diff options
author | Antti Kokko <antti.kokko@qt.io> | 2021-12-21 15:21:23 +0200 |
---|---|---|
committer | Antti Kokko <antti.kokko@qt.io> | 2022-01-19 13:13:24 +0000 |
commit | c100851d816a95d302b8c3de0b52c5538bb60ef9 (patch) | |
tree | 23af9c7388a5bf4f9960f809aa0e9455227e9853 | |
parent | 8d3c22b9ac45a6b540538d9e7305c4a8403c46d9 (diff) |
Add support for creating translation binariesv6.3.0-beta2-packagingv6.3.0-beta1-packagingv6.2.3-packaging
Some of the Linux distributions didn't recognize
readarray options, use while to loop the files.
Change-Id: I622e0165bc8fb2ba95bba092b6fae8d82257f1a6
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
-rw-r--r-- | packaging-tools/create_installer.py | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | packaging-tools/update_component_translations.sh | 16 |
2 files changed, 16 insertions, 10 deletions
diff --git a/packaging-tools/create_installer.py b/packaging-tools/create_installer.py index 9c57d1d7f..f62cf91ed 100644 --- a/packaging-tools/create_installer.py +++ b/packaging-tools/create_installer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# ## -## Copyright (C) 2020 The Qt Company Ltd. +## Copyright (C) 2021 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the release tools of the Qt Toolkit. @@ -966,6 +966,11 @@ def create_target_components(target_config): print '= Creating SDK components' print '=================================================================' print '' + # download and extract lrelease binary for creating translation binaries + if CREATE_REPOSITORY and os.environ.get("LRELEASE_TOOL"): + if not os.path.isfile(os.path.join(SCRIPT_ROOT_DIR, "lrelease")): + bld_utils.download(os.environ.get("LRELEASE_TOOL"), SCRIPT_ROOT_DIR) + bldinstallercommon.extract_file(os.path.basename(os.environ.get("LRELEASE_TOOL")), SCRIPT_ROOT_DIR) getComponentDataWork = ThreadedWork("get components data") for sdk_component in SDK_COMPONENT_LIST: # check first for top level component @@ -985,6 +990,9 @@ def create_target_components(target_config): # Copy Meta data metadata_content_source_root = os.path.normpath(sdk_component.pkg_template_dir + os.sep + 'meta') bldinstallercommon.copy_tree(metadata_content_source_root, meta_dir_dest) + if os.path.isfile(os.path.join(SCRIPT_ROOT_DIR, "lrelease")): + # create translation binaries, files are created if translation source files exist for component + subprocess.check_call([os.path.join(SCRIPT_ROOT_DIR, "update_component_translations.sh"), "-r", os.path.join(SCRIPT_ROOT_DIR, "lrelease"), dest_base]) # add files into tag substitution GENERAL_TAG_SUBST_LIST.append(meta_dir_dest) # handle archives diff --git a/packaging-tools/update_component_translations.sh b/packaging-tools/update_component_translations.sh index 970aa69aa..cb672cc1b 100644..100755 --- a/packaging-tools/update_component_translations.sh +++ b/packaging-tools/update_component_translations.sh @@ -48,27 +48,25 @@ usage() { } update() { - readarray -d '' files < <(find "$pkgroot" -name "*.ts" -print0) - for i in "${files[@]}" + find "$pkgroot" -name "*.ts" | while read fname; do - filepath="${i%/*}/" + filepath="${fname%/*}/" cd "$filepath" - "$lupdate" -locations none -no-ui-lines -no-sort -no-obsolete "$filepath" -ts "$i" + "$lupdate" -locations none -no-ui-lines -no-sort -no-obsolete "$filepath" -ts "$fname" done echo "Done" } release() { - readarray -d '' files < <(find "$pkgroot" -name "*.ts" -print0) - for i in "${files[@]}" + find "$pkgroot" -name "*.ts" | while read fname; do - filepath="${i%/*}/" + filepath="${fname%/*}/" cd "$filepath" - locale="$(basename $i .ts)" + locale="$(basename $fname .ts)" if [ $locale == "ko" -o $locale == "zh" -o $locale == "untranslated" ]; then continue fi - "$lrelease" "$i" + "$lrelease" "$fname" if grep -q ${locale}.qm package.xml; then echo "Translation file ${locale}.qm already defined in package.xml" else |