Skip to content

Commit

Permalink
make suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Moors committed Oct 28, 2023
1 parent 4b7f6ff commit bcc8014
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
18 changes: 8 additions & 10 deletions easybuild/easyblocks/h/hpcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
"""
Expand All @@ -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)
21 changes: 7 additions & 14 deletions easybuild/easyblocks/h/hpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -62,18 +61,15 @@ 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"

run_cmd(cmd, log_all=True, simple=True, log_output=True)

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)

Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit bcc8014

Please sign in to comment.