Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions easybuild/easyblocks/a/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.filetools import remove_dir, which
from easybuild.tools.filetools import clean_dir, which


class EB_Amber(CMakeMake):
Expand Down Expand Up @@ -130,8 +130,8 @@ def configure_step(self):
return

# CMake will search a previous install directory for Amber-compiled libs. We will therefore
# manually remove the install directory prior to configuration.
remove_dir(self.installdir)
# manually clean the install directory prior to configuration.
clean_dir(self.installdir)

external_libs_list = []

Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/a/anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import stat

from easybuild.easyblocks.generic.binary import Binary
from easybuild.tools.filetools import adjust_permissions, remove_dir
from easybuild.tools.filetools import adjust_permissions, clean_dir
from easybuild.tools.modules import MODULE_LOAD_ENV_HEADERS
from easybuild.tools.run import run_shell_cmd

Expand All @@ -59,7 +59,7 @@ def __init__(self, *args, **kwargs):
def install_step(self):
"""Copy all files in build directory to the install directory"""

remove_dir(self.installdir)
clean_dir(self.installdir)
install_script = self.src[0]['name']

adjust_permissions(os.path.join(self.builddir, install_script), stat.S_IRUSR | stat.S_IXUSR)
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/f/fdtd_solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def build_step(self):
def install_step(self):
"""Install FDTD Solutions using copy tree."""
fdtd_dir = os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd')
copy_dir(fdtd_dir, self.installdir, symlinks=self.cfg['keepsymlinks'])
copy_dir(fdtd_dir, self.installdir, symlinks=self.cfg['keepsymlinks'], dirs_exist_ok=True)

def sanity_check_step(self):
"""Custom sanity check for FDTD Solutions."""
Expand Down
5 changes: 3 additions & 2 deletions easybuild/easyblocks/g/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from easybuild.easyblocks.generic.cmakemake import CMakeMake
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import clean_dir, copy_dir
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import get_shared_lib_ext

Expand Down Expand Up @@ -138,8 +139,8 @@ def install_step(self):

# copy all the things
try:
shutil.rmtree(self.installdir)
shutil.copytree(self.cfg['start_dir'], self.installdir)
clean_dir(self.installdir)
copy_dir(self.cfg['start_dir'], self.installdir, dirs_exist_ok=True)
except OSError as err:
raise EasyBuildError("Failed to copy %s to %s: %s", self.cfg['start_dir'], self.installdir, err)

Expand Down
7 changes: 3 additions & 4 deletions easybuild/easyblocks/g/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
@author: Kenneth Hoste (HPC-UGent)
"""
import os
import shutil

from easybuild.tools import LooseVersion

from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import remove_dir
from easybuild.tools.filetools import clean_dir, copy_dir
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.modules import get_software_root

Expand Down Expand Up @@ -76,7 +75,7 @@ def install_step(self):
run_shell_cmd(cmd, work_dir=srcdir)

try:
remove_dir(self.installdir)
shutil.copytree(self.cfg['start_dir'], self.installdir, symlinks=self.cfg['keepsymlinks'])
clean_dir(self.installdir)
copy_dir(self.cfg['start_dir'], self.installdir, symlinks=self.cfg['keepsymlinks'], dirs_exist_ok=True)
except OSError as err:
raise EasyBuildError("Failed to copy installation to %s: %s", self.installdir, err)
17 changes: 5 additions & 12 deletions easybuild/easyblocks/generic/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
@author: Jens Timmerman (Ghent University)
"""

import shutil
import os
import stat

from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import adjust_permissions, copy_file, mkdir, remove_dir
from easybuild.tools.filetools import adjust_permissions, clean_dir, copy_dir, copy_file, mkdir
from easybuild.tools.run import run_shell_cmd


Expand Down Expand Up @@ -116,8 +115,8 @@ def install_step(self):
if install_cmd is None and install_cmds is None:
try:
# shutil.copytree doesn't allow the target directory to exist already
remove_dir(self.installdir)
shutil.copytree(self.cfg['start_dir'], self.installdir, symlinks=self.cfg['keepsymlinks'])
clean_dir(self.installdir)
copy_dir(self.cfg['start_dir'], self.installdir, symlinks=self.cfg['keepsymlinks'], dirs_exist_ok=True)
except OSError as err:
raise EasyBuildError("Failed to copy %s to %s: %s", self.cfg['start_dir'], self.installdir, err)
else:
Expand All @@ -142,14 +141,8 @@ def post_processing_step(self):
if self.cfg.get('staged_install', False):
staged_installdir = self.installdir
self.installdir = self.actual_installdir
try:
# copytree expects target directory to not exist yet
if os.path.exists(self.installdir):
remove_dir(self.installdir)
shutil.copytree(staged_installdir, self.installdir)
except OSError as err:
raise EasyBuildError("Failed to move staged install from %s to %s: %s",
staged_installdir, self.installdir, err)
clean_dir(self.installdir)
copy_dir(staged_installdir, self.installdir, dirs_exist_ok=True)

super().post_processing_step()

Expand Down
16 changes: 6 additions & 10 deletions easybuild/easyblocks/generic/tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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"""
Expand Down
6 changes: 3 additions & 3 deletions easybuild/easyblocks/j/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from easybuild.easyblocks.generic.packedbinary import PackedBinary
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.config import build_option
from easybuild.tools.filetools import adjust_permissions, change_dir, copy_dir, copy_file, remove_dir, which
from easybuild.tools.filetools import adjust_permissions, change_dir, clean_dir, copy_dir, copy_file, which
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import AARCH64, POWER, RISCV64, X86_64, get_cpu_architecture, get_shared_lib_ext
from easybuild.tools.utilities import nub
Expand Down Expand Up @@ -82,8 +82,8 @@ def extract_step(self):
def install_step(self):
"""Custom install step: just copy unpacked installation files."""
if LooseVersion(self.version) < LooseVersion('1.7'):
remove_dir(self.installdir)
copy_dir(os.path.join(self.builddir, 'jdk%s' % self.version), self.installdir)
clean_dir(self.installdir)
copy_dir(os.path.join(self.builddir, 'jdk%s' % self.version), self.installdir, dirs_exist_ok=True)
else:
PackedBinary.install_step(self)

Expand Down
7 changes: 3 additions & 4 deletions easybuild/easyblocks/m/molpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"""
import glob
import os
import shutil
import re

from easybuild.easyblocks.generic.binary import Binary
Expand All @@ -39,7 +38,7 @@
from easybuild.tools import LooseVersion
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.config import build_option
from easybuild.tools.filetools import apply_regex_substitutions, change_dir, mkdir, read_file, symlink
from easybuild.tools.filetools import apply_regex_substitutions, change_dir, clean_dir, mkdir, read_file, symlink
from easybuild.tools.run import run_shell_cmd


Expand Down Expand Up @@ -208,8 +207,8 @@ def install_step(self):

for src in self.src:
if LooseVersion(self.version) >= LooseVersion('2015'):
# install dir must be non-existent
shutil.rmtree(self.installdir)
# install dir must be non-existent or empty
clean_dir(self.installdir)
cmd = "./{0} -batch -prefix {1}".format(src['name'], self.installdir)
else:
cmd = "./{0} -batch -instbin {1}/bin -instlib {1}/lib".format(src['name'], self.installdir)
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/t/tkinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from easybuild.easyblocks.generic.pythonpackage import det_pylibdir
from easybuild.easyblocks.python import EB_Python
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import move_file, remove_dir
from easybuild.tools.filetools import clean_dir, move_file
from easybuild.tools.modules import get_software_root
from easybuild.tools.systemtools import get_shared_lib_ext

Expand Down Expand Up @@ -95,7 +95,7 @@ def install_step(self):
# Reset the install directory and remove it if it already exists. It will not have been removed automatically
# at the start of the install step, as self.installdir pointed at the temporary install directory.
self.installdir = self.orig_installdir
remove_dir(self.installdir)
clean_dir(self.installdir)

dest_pylibdir = os.path.join(self.installdir, det_pylibdir())

Expand Down