Skip to content

Commit

Permalink
clean up fallback to using get_ref in EasyBlock.check_checksums_for
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Dec 19, 2024
1 parent 6cae9c0 commit b2bee28
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2584,23 +2584,17 @@ def check_checksums_for(self, ent, sub='', source_cnt=None):
ec_fn = os.path.basename(self.cfg.path)
checksum_issues = []

if isinstance(ent, EasyConfig):
# try to get value with templates resolved, but fall back to not resolving templates;
# this is better for error reporting that includes names of source files
try:
sources = ent.get('sources', [])
patches = ent.get('patches', []) + ent.get('postinstallpatches', [])
checksums = ent.get('checksums', [])
except EasyBuildError:
sources = ent.get_ref('sources')
patches = ent.get_ref('patches') + ent.get_ref('postinstallpatches')
checksums = ent.get_ref('checksums')
elif isinstance(ent, dict):
# try to get value with templates resolved, but fall back to not resolving templates;
# this is better for error reporting that includes names of source files
try:
sources = ent.get('sources', [])
patches = ent.get('patches', []) + ent.get('postinstallpatches', [])
checksums = ent.get('checksums', [])
else:
raise EasyBuildError(f"Unexpected value type in EasyBlock.check_checksums_for: {type(ent)}")
except EasyBuildError:
if isinstance(ent, EasyConfig):
sources = ent.get_ref('sources')
patches = ent.get_ref('patches') + ent.get_ref('postinstallpatches')
checksums = ent.get_ref('checksums')

# Single source should be re-wrapped as a list, and checksums with it
if isinstance(sources, dict):
Expand Down

0 comments on commit b2bee28

Please sign in to comment.