aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2019-05-15 09:58:03 +0300
committerAntti Kokko <antti.kokko@qt.io>2019-08-22 06:25:24 +0000
commit370cbb2e529506c308300bfeee5e5493aa10b48d (patch)
treea3137a75c9cfaba82a44cdb729d9c04a1f472a07
parent0091ac39b4aea1fbcc100c9dfcbde8c71ed42c63 (diff)
Use shutil.rmtree in create_installer.py
There should be no reason to use platform specific calls. Change-Id: I1b34cd836452f1ccc96cca4e277d9f4971af8478 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
-rw-r--r--packaging-tools/create_installer.py21
1 files 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)