From bcc801401f8642438d7c9ac33d2d1dcb78833b7d Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sat, 28 Oct 2023 17:08:32 +0200 Subject: [PATCH] make suggested changes --- easybuild/easyblocks/h/hpcc.py | 18 ++++++++---------- easybuild/easyblocks/h/hpl.py | 21 +++++++-------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/easybuild/easyblocks/h/hpcc.py b/easybuild/easyblocks/h/hpcc.py index 2efd9ec759..192da6919c 100644 --- a/easybuild/easyblocks/h/hpcc.py +++ b/easybuild/easyblocks/h/hpcc.py @@ -29,10 +29,9 @@ """ import os -import shutil from easybuild.easyblocks.hpl import EB_HPL -from easybuild.tools.build_log import EasyBuildError +from easybuild.tools.filetools import copy_file, mkdir class EB_HPCC(EB_HPL): @@ -61,13 +60,10 @@ def install_step(self): srcdir = self.cfg['start_dir'] destdir = os.path.join(self.installdir, 'bin') srcfile = None - try: - os.makedirs(destdir) - for filename in ["hpcc", "_hpccinf.txt"]: - srcfile = os.path.join(srcdir, filename) - shutil.copy2(srcfile, destdir) - except OSError as err: - raise EasyBuildError("Copying %s to installation dir %s failed: %s", srcfile, destdir, err) + mkdir(destdir) + for filename in ["hpcc", "_hpccinf.txt"]: + srcfile = os.path.join(srcdir, filename) + copy_file(srcfile, destdir) def sanity_check_step(self): """ @@ -79,4 +75,6 @@ def sanity_check_step(self): 'dirs': [] } - super(EB_HPL, self).sanity_check_step(custom_paths) + custom_commands = ['hpcc'] + + super(EB_HPL, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands) diff --git a/easybuild/easyblocks/h/hpl.py b/easybuild/easyblocks/h/hpl.py index 7e34b30790..999da4ab77 100644 --- a/easybuild/easyblocks/h/hpl.py +++ b/easybuild/easyblocks/h/hpl.py @@ -33,11 +33,10 @@ """ import os -import shutil from easybuild.easyblocks.generic.configuremake import ConfigureMake from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.filetools import change_dir, remove_file, symlink +from easybuild.tools.filetools import change_dir, copy_file, mkdir, remove_file, symlink from easybuild.tools.run import run_cmd @@ -62,10 +61,7 @@ def configure_step(self, subdir=None): makeincfile = os.path.join(basedir, 'Make.UNKNOWN') setupdir = os.path.join(basedir, 'setup') - try: - change_dir(setupdir) - except OSError as err: - raise EasyBuildError("Failed to change to to dir %s: %s", setupdir, err) + change_dir(setupdir) cmd = "/bin/bash make_generic" @@ -73,7 +69,7 @@ def configure_step(self, subdir=None): try: remove_file(os.path.join(makeincfile)) - symlink(os.path.join(setupdir, 'Make.UNKNOWN'), os.path.join(makeincfile)) + symlink(os.path.join(setupdir, 'Make.UNKNOWN'), makeincfile) except OSError as err: raise EasyBuildError("Failed to symlink Make.UNKNOWN from %s to %s: %s", setupdir, makeincfile, err) @@ -122,13 +118,10 @@ def install_step(self): srcdir = os.path.join(self.cfg['start_dir'], 'bin', 'UNKNOWN') destdir = os.path.join(self.installdir, 'bin') srcfile = None - try: - os.makedirs(destdir) - for filename in ["xhpl", "HPL.dat"]: - srcfile = os.path.join(srcdir, filename) - shutil.copy2(srcfile, destdir) - except OSError as err: - raise EasyBuildError("Copying %s to installation dir %s failed: %s", srcfile, destdir, err) + mkdir(destdir) + for filename in ["xhpl", "HPL.dat"]: + srcfile = os.path.join(srcdir, filename) + copy_file(srcfile, destdir) def sanity_check_step(self): """