Skip to content

Commit

Permalink
improve error message on version mismatch when using --from-pr + rena…
Browse files Browse the repository at this point in the history
…me UNKNOWN_VERSION to UNKNOWN_EASYBLOCKS_VERSION
  • Loading branch information
boegel committed Jun 5, 2024
1 parent 0b18d96 commit 4f7a4e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
from easybuild.tools.repository.repository import init_repository
from easybuild.tools.systemtools import check_easybuild_deps
from easybuild.tools.testing import create_test_report, overall_test_report, regtest, session_state
from easybuild.tools.version import EASYBLOCKS_VERSION, FRAMEWORK_VERSION, UNKNOWN_VERSION, different_major_versions
from easybuild.tools.version import EASYBLOCKS_VERSION, FRAMEWORK_VERSION, UNKNOWN_EASYBLOCKS_VERSION
from easybuild.tools.version import different_major_versions


_log = None
Expand Down Expand Up @@ -620,7 +621,7 @@ def main(args=None, logfile=None, do_build=None, testing=False, modtool=None, pr
from_pr_list, tweaked_ecs_paths) = cfg_settings

# compare running Framework and EasyBlocks versions
if EASYBLOCKS_VERSION == UNKNOWN_VERSION:
if EASYBLOCKS_VERSION == UNKNOWN_EASYBLOCKS_VERSION:
# most likely reason is running framework unit tests with no easyblocks installation
# so log a warning, to avoid test related issues
_log.warning("Unable to determine EasyBlocks version, so we'll assume it is not different from Framework")
Expand Down
4 changes: 2 additions & 2 deletions easybuild/tools/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ def fetch_files_from_pr(pr, path=None, github_user=None, github_account=None, gi
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 PR target (%s)." % (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
4 changes: 2 additions & 2 deletions easybuild/tools/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# This causes problems further up the dependency chain...
VERSION = LooseVersion('4.9.2.dev0')
UNKNOWN = 'UNKNOWN'
UNKNOWN_VERSION = '0.0.UNKNOWN.EASYBLOCKS'
UNKNOWN_EASYBLOCKS_VERSION = '0.0.UNKNOWN.EASYBLOCKS'


def get_git_revision():
Expand Down Expand Up @@ -88,7 +88,7 @@ def get_git_revision():
try:
from easybuild.easyblocks import VERBOSE_VERSION as EASYBLOCKS_VERSION
except Exception:
EASYBLOCKS_VERSION = UNKNOWN_VERSION # make sure it is smaller then anything
EASYBLOCKS_VERSION = UNKNOWN_EASYBLOCKS_VERSION # make sure it is smaller then anything


def this_is_easybuild():
Expand Down

0 comments on commit 4f7a4e4

Please sign in to comment.