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

Allow tuples in checksums dictionary values #4745

Open
jngrad opened this issue Jan 17, 2025 · 0 comments
Open

Allow tuples in checksums dictionary values #4745

jngrad opened this issue Jan 17, 2025 · 0 comments

Comments

@jngrad
Copy link

jngrad commented Jan 17, 2025

With EasyBuild 4.9.4, the following syntax doesn't pass verify_checksum():

checksums = [{
  'espresso-237c376.tar.gz': ('sha256', '67cb83e0327fdb03e02631bfd225d11e6b5465b8c3d4ee0d7b6c0dc504f9365a'),
}]
== 2025-01-17 16:39:34,229 easyblock.py:4297 WARNING build failed (first 300 chars):
  Invalid checksum spec '['sha256', 'e08df57f132cf59dee1af91a93547e407bb442d4caa0946a136699a43d54ae36']':
  should be a string (MD5 or SHA256), 2-tuple (type, value), or tuple of alternative checksum specs.

Yet, the documentation mentions this syntax is allowed. Looking into the method code reveals the following branch is not taken:

elif isinstance(checksum, tuple):
# if checksum is specified as a tuple, it could either be specifying:
# * the type of checksum + the checksum value
# * a set of alternative valid checksums to consider => recursive call
if len(checksum) == 2 and checksum[0] in CHECKSUM_FUNCTIONS:
typ, checksum = checksum

The error message suggests to me that a parser is converting the Python syntax to a JSON-like syntax, i.e. tuples become lists.

When rewriting the condition as isinstance(checksum, (list, tuple)), the program runs as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant