Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace run_cmd with run_shell_cmd in custom easyblock for PETSc (petsc.py) #3168

Merged
Merged
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
18 changes: 10 additions & 8 deletions easybuild/easyblocks/p/petsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import symlink, apply_regex_substitutions
from easybuild.tools.modules import get_software_root, get_software_version
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import get_shared_lib_ext

NO_MPI_CXX_EXT_FLAGS = '-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX'
Expand Down Expand Up @@ -167,13 +167,13 @@ def configure_step(self):
if self.with_python:

# enable numpy support, but only if numpy is available
(_, ec) = run_cmd("python -c 'import numpy'", log_all=True, simple=False)
if ec == 0:
res = run_shell_cmd("python -c 'import numpy'", fail_on_error=False)
if res.exit_code == 0:
self.cfg.update('configopts', '--with-numpy=1')

# enable mpi4py support, but only if mpi4py is available
(_, ec) = run_cmd("python -c 'import mpi4py'", log_all=True, simple=False)
if ec == 0:
res = run_shell_cmd("python -c 'import mpi4py'", fail_on_error=False)
if res.exit_code == 0:
with_mpi4py_opt = '--with-mpi4py'
if self.cfg['shared_libs'] and with_mpi4py_opt not in self.cfg['configopts']:
self.cfg.update('configopts', '%s=1' % with_mpi4py_opt)
Expand Down Expand Up @@ -288,7 +288,8 @@ def configure_step(self):

# run configure without --prefix (required)
cmd = "%s ./configure %s" % (self.cfg['preconfigopts'], self.cfg['configopts'])
(out, _) = run_cmd(cmd, log_all=True, simple=False)
res = run_shell_cmd(cmd)
out = res.output
else:
out = super(EB_PETSc, self).configure_step()

Expand Down Expand Up @@ -327,7 +328,7 @@ def configure_step(self):
self.cfg.update('configopts', '%s=1 %s-dir=%s' % (withdep, withdep, deproot))

cmd = "./config/configure.py %s" % self.get_cfg('configopts')
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

# Make sure to set test_parallel before self.cfg['parallel'] is set to None
if self.cfg['test_parallel'] is None and self.cfg['parallel']:
Expand Down Expand Up @@ -356,7 +357,8 @@ def test_step(self):

if self.cfg['runtest']:
cmd = "%s make %s %s %s" % (self.cfg['pretestopts'], paracmd, self.cfg['runtest'], self.cfg['testopts'])
(out, _) = run_cmd(cmd, log_all=True, simple=False)
res = run_shell_cmd(cmd)
out = res.output

return out

Expand Down
Loading