From efd40471a601a268cd81ed9003ef51be1fa8395b Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Mon, 15 Sep 2025 15:35:42 +0200 Subject: [PATCH] use clean_dir instead of remove_dir on installation directory for Tarball easyblock --- easybuild/easyblocks/generic/tarball.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/easybuild/easyblocks/generic/tarball.py b/easybuild/easyblocks/generic/tarball.py index 9930aadc28d..04cf8e59e5d 100644 --- a/easybuild/easyblocks/generic/tarball.py +++ b/easybuild/easyblocks/generic/tarball.py @@ -40,7 +40,7 @@ from easybuild.framework.extensioneasyblock import ExtensionEasyBlock from easybuild.framework.easyconfig import CUSTOM from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.filetools import copy_dir, extract_file, remove_dir +from easybuild.tools.filetools import clean_dir, copy_dir, extract_file, remove_dir from easybuild.tools.run import run_shell_cmd @@ -102,27 +102,23 @@ def install_step(self, src=None): if self.cfg['install_type'] == 'subdir': # Wipe and install in a sub-directory with the name of the package install_path = os.path.join(self.installdir, self.name.lower()) - dirs_exist_ok = False install_logmsg = "Copying tarball contents of %s to sub-directory %s..." + remove_dir(install_path) elif self.cfg['install_type'] == 'merge': # Enable merging with root of existing installdir install_path = self.installdir - dirs_exist_ok = True install_logmsg = "Merging tarball contents of %s into %s..." elif self.cfg['install_type'] is None: - # Wipe and copy root of installation directory (default) + # Clean and copy root of installation directory (default) install_path = self.installdir - dirs_exist_ok = False - install_logmsg = "Copying tarball contents of %s into %s after wiping it..." + install_logmsg = "Copying tarball contents of %s into %s after cleaning it..." + clean_dir(install_path) else: raise EasyBuildError("Unknown option '%s' for index_type.", self.cfg['install_type']) self.log.info(install_logmsg, self.name, install_path) - if not dirs_exist_ok: - remove_dir(install_path) - - copy_dir(source_path, install_path, symlinks=self.cfg['keepsymlinks'], dirs_exist_ok=dirs_exist_ok) + copy_dir(source_path, install_path, symlinks=self.cfg['keepsymlinks'], dirs_exist_ok=True) def sanity_check_rpath(self): """Skip the rpath sanity check, this is binary software"""