Describe the bug
files.download operation fails to check sha256 hash on macOS host.
To Reproduce
Run a files.download operation on a macOS host and specify a sha256sum argument:
files.download(
name = 'Download'
,src = 'https://...'
,dest = '...'
,sha256sum = 'sha256sum of the file'
)
Expected behavior
The sum verification to work.
The operation seems to try sha256sum and sha256, but not sha2sum which is what's on macOS. This seems to be similar to the shasum one reported on #365:
sh -c '((sha256sum /Users/myuser/myfile.tar.gz 2> /dev/null || sha256 /Users/myuser/myfile.tar.gz) | grep...) || (echo "SHA256 did not match!" && exit 1)'
Which version of MacOS is this out of interest? I've not got sha2sum locally but do have sha256 sum (using Catalina)!
UPDATE: looks like shasum -a 256 is builtin on MacOS everywhere so should work.
I am using Catalina also.
UPDATE: looks like shasum -a 256 is builtin on MacOS everywhere so should work.
My mistake! I did mean shasum, I am not sure why I wrote shas2sum, sorry about that.
I just tried on 3 different Catalina installs, one which is fresh, and none had sha256, or sha256sum, just shasum.
I've fixed this in https://github.com/Fizzadar/pyinfra/commit/63982095f08fb28b5ca16046a798104b025c38e9 and now released v1.1.1!