Skip to content

Commit

Permalink
Merge branch '5.0.x' of github.com:branfosj/easybuild-easyblocks into…
Browse files Browse the repository at this point in the history
… 20240129114808_new_pr_UVhZoEOVCC
  • Loading branch information
branfosj committed Jan 29, 2024
2 parents 8901a1e + 2e85c8c commit e52babf
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 86 deletions.
4 changes: 2 additions & 2 deletions easybuild/easyblocks/a/anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

from easybuild.easyblocks.generic.binary import Binary
from easybuild.tools.filetools import adjust_permissions, remove_dir
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd


class EB_Anaconda(Binary):
Expand All @@ -51,7 +51,7 @@ def install_step(self):
# Anacondas own install instructions specify "bash [script]" despite using different shebangs
cmd = "%s bash ./%s -p %s -b -f" % (self.cfg['preinstallopts'], install_script, self.installdir)
self.log.info("Installing %s using command '%s'..." % (self.name, cmd))
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

def make_module_req_guess(self):
"""
Expand Down
18 changes: 9 additions & 9 deletions easybuild/easyblocks/b/binutils.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 apply_regex_substitutions, copy_file
from easybuild.tools.modules import get_software_libdir, get_software_root
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import RISCV, get_cpu_family, get_shared_lib_ext
from easybuild.tools.utilities import nub

Expand Down Expand Up @@ -70,11 +70,11 @@ def determine_used_library_paths(self):
compiler_cmd = os.environ.get('CC', 'gcc')

# determine library search paths for GCC
stdout, ec = run_cmd('LC_ALL=C "%s" -print-search-dirs' % compiler_cmd, simple=False, log_all=True)
if ec:
res = run_shell_cmd('LC_ALL=C "%s" -print-search-dirs' % compiler_cmd)
if res.exit_code:
raise EasyBuildError("Failed to determine library search dirs from compiler %s", compiler_cmd)

m = re.search('^libraries: *=(.*)$', stdout, re.M)
m = re.search('^libraries: *=(.*)$', res.output, re.M)
paths = nub(os.path.abspath(p) for p in m.group(1).split(os.pathsep))
self.log.debug('Unique library search paths from compiler %s: %s', compiler_cmd, paths)

Expand Down Expand Up @@ -259,14 +259,14 @@ def sanity_check_step(self):
if any(dep['name'] == 'zlib' for dep in build_deps):
for binary in binaries:
bin_path = os.path.join(self.installdir, 'bin', binary)
out, _ = run_cmd("file %s" % bin_path, simple=False)
if re.search(r'statically linked', out):
res = run_shell_cmd("file %s" % bin_path)
if re.search(r'statically linked', res.output):
# binary is fully statically linked, so no chance for dynamically linked libz
continue

# check whether libz is linked dynamically, it shouldn't be
out, _ = run_cmd("ldd %s" % bin_path, simple=False)
if re.search(r'libz\.%s' % shlib_ext, out):
raise EasyBuildError("zlib is not statically linked in %s: %s", bin_path, out)
res = run_shell_cmd("ldd %s" % bin_path)
if re.search(r'libz\.%s' % shlib_ext, res.output):
raise EasyBuildError("zlib is not statically linked in %s: %s", bin_path, res.output)

super(EB_binutils, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)
8 changes: 4 additions & 4 deletions easybuild/easyblocks/b/boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from easybuild.tools.config import ERROR
from easybuild.tools.filetools import apply_regex_substitutions, read_file, symlink, which, write_file
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 AARCH64, POWER, UNKNOWN
from easybuild.tools.systemtools import get_cpu_architecture, get_glibc_version, get_shared_lib_ext

Expand Down Expand Up @@ -144,7 +144,7 @@ def configure_step(self):

cmd = "%s ./bootstrap.sh --with-toolset=%s --prefix=%s %s"
tup = (self.cfg['preconfigopts'], toolset, self.installdir, self.cfg['configopts'])
run_cmd(cmd % tup, log_all=True, simple=True)
run_shell_cmd(cmd % tup)

# Use build_toolset if specified or the bootstrap toolset without the OS suffix
self.toolset = self.cfg['build_toolset'] or re.sub('-linux$', '', toolset)
Expand Down Expand Up @@ -282,7 +282,7 @@ def build_step(self):
self.paracmd,
self.cfg['buildopts'],
])
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

def install_step(self):
"""Install Boost by copying files to install dir."""
Expand All @@ -298,7 +298,7 @@ def install_step(self):
self.paracmd,
self.cfg['installopts'],
])
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

if self.cfg['tagged_layout']:
if LooseVersion(self.version) >= LooseVersion("1.69.0") or not self.cfg['single_threaded']:
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/b/bzip2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import get_shared_lib_ext


Expand Down Expand Up @@ -70,7 +70,7 @@ def install_step(self):
if self.cfg['with_shared_libs']:

cmd = "%s make -f Makefile-libbz2_so %s" % (self.cfg['prebuildopts'], self.cfg['buildopts'])
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

# copy shared libraries to <install dir>/lib
shlib_ext = get_shared_lib_ext()
Expand Down
76 changes: 16 additions & 60 deletions easybuild/easyblocks/s/scalapack.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
from easybuild.tools import LooseVersion

import easybuild.tools.toolchain as toolchain
from easybuild.easyblocks.blacs import det_interface # @UnresolvedImport
from easybuild.easyblocks.generic.cmakemake import CMakeMake
from easybuild.toolchains.linalg.acml import Acml
from easybuild.toolchains.linalg.atlas import Atlas
from easybuild.toolchains.linalg.blacs import Blacs
from easybuild.toolchains.linalg.blis import Blis
from easybuild.toolchains.linalg.flexiblas import FlexiBLAS, det_flexiblas_backend_libs
from easybuild.toolchains.linalg.gotoblas import GotoBLAS
Expand All @@ -51,7 +49,7 @@
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import copy_file, remove_file
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd


class EB_ScaLAPACK(CMakeMake):
Expand Down Expand Up @@ -90,13 +88,11 @@ def build_libscalapack_make(self):
known_mpi_libs = [toolchain.MPICH, toolchain.MPICH2, toolchain.MVAPICH2] # @UndefinedVariable
known_mpi_libs += [toolchain.OPENMPI, toolchain.QLOGICMPI] # @UndefinedVariable
known_mpi_libs += [toolchain.INTELMPI] # @UndefinedVariable
if os.getenv('MPICC') and os.getenv('MPIF77') and os.getenv('MPIF90'):
if os.getenv('MPICC') and os.getenv('MPIF90'):
mpicc = os.getenv('MPICC')
mpif77 = os.getenv('MPIF77')
mpif90 = os.getenv('MPIF90')
elif self.toolchain.mpi_family() in known_mpi_libs:
mpicc = 'mpicc'
mpif77 = 'mpif77'
mpif90 = 'mpif90'
else:
raise EasyBuildError("Don't know which compiler commands to use.")
Expand Down Expand Up @@ -155,62 +151,22 @@ def build_libscalapack_make(self):
else:
raise EasyBuildError("Unknown LAPACK library used, no idea how to set BLASLIB/LAPACKLIB make options")

# build procedure changed in v2.0.0
if self.loosever < LooseVersion('2.0.0'):

blacs = get_software_root(Blacs.BLACS_MODULE_NAME[0])
if not blacs:
raise EasyBuildError("BLACS not available, yet required for ScaLAPACK version < 2.0.0")

# determine interface
interface = det_interface(self.log, os.path.join(blacs, 'bin'))

# set build and BLACS dir correctly
extra_makeopts.append('home=%s BLACSdir=%s' % (self.cfg['start_dir'], blacs))

# set BLACS libs correctly
blacs_libs = [
('BLACSFINIT', "F77init"),
('BLACSCINIT', "Cinit"),
('BLACSLIB', "")
]
for (var, lib) in blacs_libs:
extra_makeopts.append('%s=%s/lib/libblacs%s.a' % (var, blacs, lib))

# set compilers and options
noopt = ''
if self.toolchain.options['noopt']:
noopt += " -O0"
if self.toolchain.options['pic']:
noopt += " -fPIC"
extra_makeopts += [
'F77="%s"' % mpif77,
'CC="%s"' % mpicc,
'NOOPT="%s"' % noopt,
'CCFLAGS="-O3 %s"' % os.getenv('CFLAGS')
]

# set interface
extra_makeopts.append("CDEFS='-D%s -DNO_IEEE $(USEMPI)'" % interface)

# determine interface
if self.toolchain.mpi_family() in known_mpi_libs:
interface = 'Add_'
else:
raise EasyBuildError("Don't know which interface to pick for the MPI library being used.")

# determine interface
if self.toolchain.mpi_family() in known_mpi_libs:
interface = 'Add_'
else:
raise EasyBuildError("Don't know which interface to pick for the MPI library being used.")

# set compilers and options
extra_makeopts += [
'FC="%s"' % mpif90,
'CC="%s"' % mpicc,
'CCFLAGS="%s"' % os.getenv('CFLAGS'),
'FCFLAGS="%s"' % os.getenv('FFLAGS'),
]
# set compilers and options
extra_makeopts += [
'FC="%s"' % mpif90,
'CC="%s"' % mpicc,
'CCFLAGS="%s"' % os.getenv('CFLAGS'),
'FCFLAGS="%s"' % os.getenv('FFLAGS'),
]

# set interface
extra_makeopts.append('CDEFS="-D%s"' % interface)
# set interface
extra_makeopts.append('CDEFS="-D%s"' % interface)

# update make opts, and build_step
saved_buildopts = self.cfg['buildopts']
Expand All @@ -229,7 +185,7 @@ def build_libscalapack_make(self):
cmd = "%s make %s %s" % (self.cfg['prebuildopts'], paracmd, self.cfg['buildopts'])

# Ignore exit code for parallel run
(out, _) = run_cmd(cmd, log_ok=False, log_all=False, simple=False)
run_shell_cmd(cmd, fail_on_error=False)

# Now prepare to remake libscalapack.a serially and the tests.
self.cfg['buildopts'] = saved_buildopts
Expand Down
10 changes: 5 additions & 5 deletions easybuild/easyblocks/w/wxpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from easybuild.easyblocks.generic.pythonpackage import PythonPackage, det_python_version
from easybuild.tools.filetools import change_dir, symlink
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import get_shared_lib_ext


Expand All @@ -63,10 +63,10 @@ def build_step(self):
# Do we need to build wxWidgets internally?
if self.wxflag == '':
cmd = base_cmd + " build_wx"
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

cmd = base_cmd + " %s build_py" % self.wxflag
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

def install_step(self):
"""Custom install procedure for wxPython."""
Expand All @@ -83,7 +83,7 @@ def install_step(self):
}
# install fails and attempts to install in the python module. building the wheel, and then installing it
cmd = cmd + " %s -v bdist_wheel" % self.wxflag
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

# get whether it is 35, 36, 37, 38, etc.
pyver = det_python_version(self.python_cmd)
Expand All @@ -106,7 +106,7 @@ def install_step(self):
}
cmd = cmd + " --wxpy_installdir=%s --install" % self.installdir

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

# add symbolic links for libwx_*so.* files
# (which are created automatically by 'build.py install', but not by 'pip install *.whl')
Expand Down
8 changes: 4 additions & 4 deletions easybuild/easyblocks/x/xmipp.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from easybuild.tools.filetools import apply_regex_substitutions, change_dir
from easybuild.tools.filetools import copy_file, mkdir, remove_file, symlink
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


Expand Down Expand Up @@ -112,7 +112,7 @@ def configure_step(self):
noask,
self.cfg['configopts'],
])
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

# Parameters to be set in the config file
params = {
Expand Down Expand Up @@ -237,7 +237,7 @@ def build_step(self):
'all',
self.cfg['buildopts'],
])
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)
change_dir(cwd)
xmipp_lib = os.path.join(self.srcdir, 'xmipp', 'lib')
mkdir(xmipp_lib)
Expand Down Expand Up @@ -265,7 +265,7 @@ def install_step(self):
self.installdir,
self.cfg['installopts'],
])
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

# Remove the bash and fish files. Everything should be in the module
remove_file(os.path.join(self.installdir, 'xmipp.bashrc'))
Expand Down

0 comments on commit e52babf

Please sign in to comment.