diff options
author | Antti Kokko <antti.kokko@qt.io> | 2022-10-24 07:09:53 +0000 |
---|---|---|
committer | Antti Kokko <antti.kokko@qt.io> | 2022-10-26 12:28:37 +0000 |
commit | 6875087b7b19b7d808aa037280ebcb41a56d5e38 (patch) | |
tree | f7c162973b153c92eace97e2b8fae00368afc85c /packaging-tools/bld_module.py | |
parent | 64b709d4b422e6d59f9e703fbc1124dd3f77d556 (diff) |
Revert "Revert "Use logging functions from logging_util.py""
This reverts commit 64b709d4b422e6d59f9e703fbc1124dd3f77d556.
Reason for revert: required dependent changes are done, we can bring this change back
Change-Id: I1692b433eda3fd2a1e5aa541785dae942cbd1665
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
Diffstat (limited to 'packaging-tools/bld_module.py')
-rwxr-xr-x | packaging-tools/bld_module.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/packaging-tools/bld_module.py b/packaging-tools/bld_module.py index 0d06d23ca..bda7a1180 100755 --- a/packaging-tools/bld_module.py +++ b/packaging-tools/bld_module.py @@ -59,9 +59,12 @@ from bldinstallercommon import ( search_for_files, ) from installer_utils import PackagingError +from logging_util import init_logger from runner import do_execute_sub_process from threadedwork import ThreadedWork +log = init_logger(__name__, debug_mode=False) + SCRIPT_ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) MODULE_SRC_DIR_NAME = 'module_src' MODULE_SRC_DIR = os.path.join(SCRIPT_ROOT_DIR, MODULE_SRC_DIR_NAME) @@ -88,7 +91,7 @@ def get_qt_install_prefix(qt_path: str) -> str: # function ############################### def erase_qmake_prl_build_dir(search_path: str) -> None: - print('--- Fix .prl files ---') + log.info("--- Fix .prl files ---") # fetch all .prl files file_list = locate_paths(search_path, ['*.prl'], filters=[os.path.isfile]) # erase lines starting with 'QMAKE_PRL_BUILD_DIR' from .prl files @@ -97,11 +100,11 @@ def erase_qmake_prl_build_dir(search_path: str) -> None: for line in FileInput(item, inplace=True): if line.startswith('QMAKE_PRL_BUILD_DIR'): found = True - print(''.rstrip('\n')) + log.info("".rstrip("\n")) else: - print(line.rstrip('\n')) + log.info(line.rstrip("\n")) if found: - print(f"Erased 'QMAKE_PRL_BUILD_DIR' from: {item}") + log.info("Erased 'QMAKE_PRL_BUILD_DIR' from: %s", item) ############################### @@ -113,12 +116,12 @@ def patch_build_time_paths(search_path: str, search_strings: List[str], qt_insta file_list = search_for_files(search_path, extension_list, search_regexp) for item in file_list: - print(f"Replacing {search_strings} paths from file: {item}") + log.info("Replacing %s paths from file: %s", search_strings, item) for line in FileInput(item, inplace=True): patched_line = reduce(lambda accum, value: accum.replace(value, qt_install_prefix), search_strings, line) - print(patched_line.rstrip('\n')) + log.info(patched_line.rstrip("\n")) def main() -> None: @@ -185,7 +188,10 @@ def main() -> None: # cleanup some values inside the caller_arguments object strip_vars(caller_arguments, "\"") if caller_arguments.qt5path != os.path.abspath(caller_arguments.qt5path): - print(f"changing the value of --qt5path from {caller_arguments.qt5path} to {os.path.abspath(caller_arguments.qt5path)}") + log.info( + "Changing the value of --qt5path: %s -> %s", + caller_arguments.qt5path, os.path.abspath(caller_arguments.qt5path) + ) caller_arguments.qt5path = os.path.abspath(caller_arguments.qt5path) if not caller_arguments.module_name: @@ -205,7 +211,7 @@ def main() -> None: my_get_qt_module.run() qt_module_source_directory = MODULE_SRC_DIR else: - print(f"Using local copy of {caller_arguments.module_name}") + log.info("Using local copy of %s", caller_arguments.module_name) qt_module_source_directory = caller_arguments.module_dir # install directory @@ -220,14 +226,17 @@ def main() -> None: # clean step if caller_arguments.clean: - print("##### clean old builds #####") + log.info("##### clean old builds #####") remove_tree(caller_arguments.qt5path) remove_tree(qt_module_install_directory) remove_tree(temp_path) if not os.path.lexists(caller_arguments.qt5path) and not caller_arguments.qt5_module_urls: parser.print_help() - print(f"error: Please add the missing qt5_module_url arguments if the {caller_arguments.qt5path} does not exist {os.linesep}{os.linesep}") + log.error( + "The --qt5path %s does not exist, please add the missing --qt5_module_url arguments", + caller_arguments.qt5path + ) raise RuntimeError() qmake_binary = os.path.abspath(os.path.join(caller_arguments.qt5path, 'bin', 'qmake')) |