Skip to content

Commit 7da7b2b

Browse files
committed
Show possible locations when specifying non-existant paths in github CLI integration
1 parent 633cc4b commit 7da7b2b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

easybuild/tools/github.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,10 @@ def download_repo(repo=GITHUB_EASYCONFIGS_REPO, branch=None, commit=None, accoun
431431
else:
432432
_log.debug("%s downloaded to %s, extracting now", base_name, path)
433433

434-
base_dir = extract_file(target_path, path, forced=True, change_into_dir=False, trace=False)
435-
extracted_path = os.path.join(base_dir, extracted_dir_name)
434+
extracted_path = extract_file(target_path, path, forced=True, change_into_dir=False, trace=False)
435+
if extracted_path != expected_path:
436+
raise EasyBuildError(f"Unexpected directory '{extracted_path} for extracted repo. Expected: {expected_path}",
437+
exit_code=EasyBuildExit.FAIL_EXTRACT)
436438

437439
# check if extracted_path exists
438440
if not os.path.isdir(extracted_path):
@@ -1073,10 +1075,11 @@ def _easyconfigs_pr_common(paths, ecs, start_branch=None, pr_branch=None, start_
10731075
ec_paths.append(path)
10741076

10751077
if non_existing_paths:
1076-
raise EasyBuildError(
1077-
"One or more non-existing paths specified: %s", ', '.join(non_existing_paths),
1078-
exit_code=EasyBuildExit.OPTION_ERROR
1079-
)
1078+
msg = "One or more non-existing paths specified: " + ', '.join(non_existing_paths)
1079+
found_ecs = {ec['spec'] for ec in ecs if os.path.basename(ec['spec']) in non_existing_paths}
1080+
if found_ecs:
1081+
msg += '\nDid you mean: ' + ', '.join(found_ecs)
1082+
raise EasyBuildError(msg, exit_code=EasyBuildExit.OPTION_ERROR)
10801083

10811084
if not any(paths.values()):
10821085
raise EasyBuildError("No paths specified", exit_code=EasyBuildExit.OPTION_ERROR)

0 commit comments

Comments
 (0)