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 binutils (binutils.py) #3105

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)