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 easyconfigs testsuite #19818

Merged
merged 5 commits into from
Feb 12, 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
16 changes: 8 additions & 8 deletions test/easyconfigs/easyconfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version
from easybuild.tools.modules import modules_tool
from easybuild.tools.robot import check_conflicts, resolve_dependencies
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.options import set_tmpdir
from easybuild.tools.utilities import nub

Expand Down Expand Up @@ -111,20 +111,20 @@ def get_files_from_diff(diff_filter, ext):
# first determine the 'merge base' between target branch and PR branch
# cfr. https://git-scm.com/docs/git-merge-base
cmd = "git merge-base %s HEAD" % target_branch
out, ec = run_cmd(cmd, simple=False, log_ok=False)
if ec == 0:
merge_base = out.strip()
res = run_shell_cmd(cmd, fail_on_error=False)
if res.exit_code == 0:
merge_base = res.output.strip()
print("Merge base for %s and HEAD: %s" % (target_branch, merge_base))
else:
msg = "Failed to determine merge base (ec: %s, output: '%s'), "
msg = "Failed to determine merge base (exit_code: %s, output: '%s'), "
msg += "falling back to specifying target branch %s"
print(msg % (ec, out, target_branch))
print(msg % (res.exit_code, res.output, target_branch))
merge_base = target_branch

# determine list of changed files using 'git diff' and merge base determined above
cmd = "git diff --name-only --diff-filter=%s %s..HEAD --" % (diff_filter, merge_base)
out, _ = run_cmd(cmd, simple=False)
files = [os.path.join(top_dir, f) for f in out.strip().split('\n') if f.endswith(ext)]
res = run_shell_cmd(cmd)
files = [os.path.join(top_dir, f) for f in res.output.strip().split('\n') if f.endswith(ext)]

change_dir(cwd)
return files
Expand Down