From 370cbb2e529506c308300bfeee5e5493aa10b48d Mon Sep 17 00:00:00 2001 From: Iikka Eklund Date: Wed, 15 May 2019 09:58:03 +0300 Subject: Use shutil.rmtree in create_installer.py There should be no reason to use platform specific calls. Change-Id: I1b34cd836452f1ccc96cca4e277d9f4971af8478 Reviewed-by: Antti Kokko --- packaging-tools/create_installer.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/packaging-tools/create_installer.py b/packaging-tools/create_installer.py index a242956c3..c98d4051e 100644 --- a/packaging-tools/create_installer.py +++ b/packaging-tools/create_installer.py @@ -464,19 +464,9 @@ def clean_work_dirs(): """Clean working directories.""" print '----------------------------------------' print ' Cleaning environment' - - # delete "/packages" - if os.path.exists(PACKAGES_FULL_PATH_DST): - bldinstallercommon.remove_tree(PACKAGES_FULL_PATH_DST) - print ' -> deleted old existing directory: ' + PACKAGES_FULL_PATH_DST - # delete "/repositories" - if os.path.exists(REPO_OUTPUT_DIR): - bldinstallercommon.remove_tree(REPO_OUTPUT_DIR) - print ' -> deleted old existing directory: ' + REPO_OUTPUT_DIR - # delete "/config" - if os.path.exists(CONFIG_DIR_DST): - bldinstallercommon.remove_tree(CONFIG_DIR_DST) - print ' -> deleted old existing directory: ' + CONFIG_DIR_DST + shutil.rmtree(PACKAGES_FULL_PATH_DST, ignore_errors=True) # delete "/packages" + shutil.rmtree(REPO_OUTPUT_DIR, ignore_errors=True) # delete "/repositories" + shutil.rmtree(CONFIG_DIR_DST, ignore_errors=True) # delete "/config" ############################################################## @@ -886,7 +876,7 @@ def remove_debug_information_files_by_file_type(install_dir, debug_information_f if d.endswith('dSYM'): list_of_debug_information_files.append(os.path.join(root, d)) for debug_information in list_of_debug_information_files: - bldinstallercommon.remove_tree(debug_information) + shutil.rmtree(debug_information) else: # This will only take the text connected to the debug information file by grabbing all non-space characters (\S) bldinstallercommon.delete_files_by_type_recursive(debug_information_dir, '\S*\.' + debug_information_file_ending) # pylint: disable=W1401 @@ -1018,8 +1008,7 @@ def create_target_components(target_config): substitute_component_tags(create_metadata_map(sdk_component), sdk_component.meta_dir_dest) if hasattr(sdk_component, 'temp_data_dir') and os.path.exists(sdk_component.temp_data_dir): # lastly remove temp dir after all data is prepared - if not bldinstallercommon.remove_tree(sdk_component.temp_data_dir): - raise IOError('Unable to remove directory: %s' % sdk_component.temp_data_dir) + shutil.rmtree(sdk_component.temp_data_dir) # substitute downloadable archive names in installscript.qs substitute_component_tags(sdk_component.generate_downloadable_archive_list(), sdk_component.meta_dir_dest) -- cgit v1.2.3