On 10/20/2017 12:26 PM, Michał Górny wrote:
> ---
>  .travis.yml             |  2 ++
>  pym/portage/checksum.py | 15 +++++++++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 20078530e..ebcfbeab9 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -12,6 +12,8 @@ install:
>      # python3.6+ has sha3 built-in, for older versions install pysha3
>      # (except for pypy where pysha3 is broken)
>      - "[[ ${TRAVIS_PYTHON_VERSION} == 3.[6789] || ${TRAVIS_PYTHON_VERSION} 
> == pypy ]] || pip install pysha3"
> +    # python3.6+ has blake2 built-in, for older versions install pyblake2
> +    - "[[ ${TRAVIS_PYTHON_VERSION} == 3.[6789] ]] || pip install pyblake2"
>      # always install pygost for Streebog
>      - pip install pygost
>  
> diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
> index ff132751b..ad090ddb3 100644
> --- a/pym/portage/checksum.py
> +++ b/pym/portage/checksum.py
> @@ -27,8 +27,8 @@ import tempfile
>  # SHA512: hashlib
>  # RMD160: hashlib, pycrypto, mhash
>  # WHIRLPOOL: hashlib, mhash, bundled
> -# BLAKE2B (512): hashlib (3.6+), pycrypto
> -# BLAKE2S (512): hashlib (3.6+), pycrypto
> +# BLAKE2B (512): hashlib (3.6+), pyblake2, pycrypto
> +# BLAKE2S (512): hashlib (3.6+), pyblake2, pycrypto
>  # SHA3_256: hashlib (3.6+), pysha3, pycrypto
>  # SHA3_512: hashlib (3.6+), pysha3, pycrypto
>  
> @@ -124,6 +124,17 @@ for local_name, hash_name in (
>                       origin='hashlib')
>  
>  
> +# Support using pyblake2 as fallback for python<3.6
> +if "BLAKE2B" not in hashfunc_map or "BLAKE2S" not in hashfunc_map:
> +     try:
> +             import pyblake2
> +
> +             _generate_hash_function("BLAKE2B", pyblake2.blake2b, 
> origin="pyblake2")
> +             _generate_hash_function("BLAKE2S", pyblake2.blake2s, 
> origin="pyblake2")
> +     except ImportError:
> +             pass
> +
> +
>  # Support using pysha3 as fallback for python<3.6
>  if "SHA3_256" not in hashfunc_map or "SHA3_512" not in hashfunc_map:
>       try:
> 

Looks good, please merge.
-- 
Thanks,
Zac

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to