Skip to content

Commit

Permalink
don't try to determine repo version when file that contains version d…
Browse files Browse the repository at this point in the history
…oesn't exist
  • Loading branch information
boegel committed Jun 7, 2024
1 parent 64bf5c6 commit d4fdbae
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions easybuild/tools/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,13 +589,19 @@ def fetch_files_from_pr(pr, path=None, github_user=None, github_account=None, gi
raise EasyBuildError("Couldn't find path to patched file %s", full_path)

if github_repo == GITHUB_EASYCONFIGS_REPO:
ver = _get_version_for_repo(os.path.join(final_path, 'setup.py'))
ver_file = os.path.join(final_path, 'setup.py')
elif github_repo == GITHUB_EASYBLOCKS_REPO:
ver = _get_version_for_repo(os.path.join(final_path, 'easybuild', 'easyblocks', '__init__.py'))

if different_major_versions(FRAMEWORK_VERSION, ver):
raise EasyBuildError("Framework (%s) is a different major version than used in %s/%s PR #%s (%s)",
FRAMEWORK_VERSION, github_account, github_repo, pr, ver)
ver_file = os.path.join(final_path, 'easybuild', 'easyblocks', '__init__.py')
else:
raise EasyBuildError("Don't know how to determine version for repo %s", github_repo)

# take into account that the file we need to determine repo version may not be available,
# for example when a closed PR is used (since then we only download files patched by the PR)
if os.path.exists(ver_file):
ver = _get_version_for_repo(ver_file)
if different_major_versions(FRAMEWORK_VERSION, ver):
raise EasyBuildError("Framework (%s) is a different major version than used in %s/%s PR #%s (%s)",
FRAMEWORK_VERSION, github_account, github_repo, pr, ver)

return files

Expand Down

0 comments on commit d4fdbae

Please sign in to comment.