diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-01-11 12:05:20 +0200 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-02-14 08:18:36 +0000 |
commit | 1a57b806c77c2a97328039402d90357dbc4f0c7c (patch) | |
tree | d7fc3a444296013bc9012ac0148cfe1a8f39e377 /packaging-tools/create_installer.py | |
parent | bdbbef90a40a728530e0919f9e643bc7edc9dc66 (diff) |
bldinstallercommon: improve dir strip functionality, add unit testsv6.5.0-beta3-packaging
- Switch os.path style paths -> pathlib.Path
- Switch move function: move_tree -> shutil.move
- Add missing unit tests
- Improve logging, error messages
- Add docstring
Change-Id: Ie8c0abe3af0163127dbfe2a016b0471bf9705b0a
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
Diffstat (limited to 'packaging-tools/create_installer.py')
-rw-r--r-- | packaging-tools/create_installer.py | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/packaging-tools/create_installer.py b/packaging-tools/create_installer.py index 9a7985c35..ab7c020af 100644 --- a/packaging-tools/create_installer.py +++ b/packaging-tools/create_installer.py @@ -55,11 +55,11 @@ from bldinstallercommon import ( locate_executable, locate_path, locate_paths, - remove_one_tree_level, remove_tree, replace_in_files, retrieve_url, safe_config_key_fetch, + strip_dirs, uri_exists, ) from installer_utils import PackagingError @@ -395,22 +395,6 @@ def get_component_sha1(sdk_comp: IfwSdkComponent, sha1_file_dest: Path) -> None: read_component_sha(sdk_comp=sdk_comp, sha1_file_path=sha1_file_dest) -def strip_dirs(iterations: int, install_dir: Path) -> None: - """ - Strip out unnecessary folder structure based on the configuration - - Args: - iterations: Specifies how many tree levels to remove (0=do nothing) - install_dir: A file system path to the folder to strip from - - Raises: - IOError: When there are too many tree levels to be removed based on the structure - """ - while iterations: - remove_one_tree_level(str(install_dir)) # TODO: use shutil.move here - iterations -= 1 - - def delete_docs(directory: Path) -> None: """ Delete doc directory from directory if exists @@ -555,7 +539,7 @@ def patch_component_data( """ if archive.archive_action: exec_action_script(archive.archive_action, install_dir) - strip_dirs(archive.package_strip_dirs, install_dir) + strip_dirs(install_dir, archive.package_strip_dirs) finalize_items(task, archive.package_finalize_items, install_dir) process_debug_files_and_libs( archive.archive_name, |