Skip to content

Commit

Permalink
Merge pull request #3168 from bartoldeman/20240207124912_new_pr_petsc
Browse files Browse the repository at this point in the history
replace `run_cmd` with `run_shell_cmd` in custom easyblock for PETSc (`petsc.py`)
  • Loading branch information
branfosj authored Feb 8, 2024
2 parents 47fae85 + 26c9348 commit 50b93aa
Showing 1 changed file with 10 additions and 8 deletions.
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

0 comments on commit 50b93aa

Please sign in to comment.