From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2718F15A7DA for ; Tue, 21 Mar 2023 02:30:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C102FE079E; Tue, 21 Mar 2023 02:30:35 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8CA6FE0798 for ; Tue, 21 Mar 2023 02:30:35 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7C78B341237 for ; Tue, 21 Mar 2023 02:30:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 30A298EC for ; Tue, 21 Mar 2023 02:30:32 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1679365824.d8c8d84f07a299b66dbd38ac7a294989d1315040.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/checksum.py X-VCS-Directories: lib/portage/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: d8c8d84f07a299b66dbd38ac7a294989d1315040 X-VCS-Branch: master Date: Tue, 21 Mar 2023 02:30:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f594bca8-8998-4622-9a31-2627f8fc2399 X-Archives-Hash: ace7312a62b870712c31a76b1287c647 commit: d8c8d84f07a299b66dbd38ac7a294989d1315040 Author: Sam James gentoo org> AuthorDate: Mon Mar 20 03:26:28 2023 +0000 Commit: Sam James gentoo org> CommitDate: Tue Mar 21 02:30:24 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d8c8d84f checksum: drop < Python 3.6 checksum compatibilty via pyblake2, sha3 We've only supported >= Python 3.6 for quite some time, so these codepaths are obsolete given hashlib will always provide support for BLAKE2 and SHA3. Neither pyblake2 nor sha3 are even packaged in Gentoo anymore either (the Python bindings). Signed-off-by: Sam James gentoo.org> lib/portage/checksum.py | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py index fdb8387a7..1797f268a 100644 --- a/lib/portage/checksum.py +++ b/lib/portage/checksum.py @@ -27,10 +27,10 @@ from portage.localization import _ # SHA512: hashlib # RMD160: hashlib, pycrypto, mhash # WHIRLPOOL: hashlib, mhash, bundled -# 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 +# BLAKE2B (512): hashlib, pycrypto +# BLAKE2S (512): hashlib,pycrypto +# SHA3_256: hashlib, pycrypto +# SHA3_512: hashlib, pycrypto # Dict of all available hash functions @@ -101,7 +101,7 @@ class _generate_hash_function: # already defined. -# Use hashlib from python-2.5 if available and prefer it over pycrypto and internal fallbacks. +# Use hashlib if available and prefer it over pycrypto and internal fallbacks. # Need special handling for RMD160/WHIRLPOOL as they may not always be provided by hashlib. _generate_hash_function("MD5", hashlib.md5, origin="hashlib") _generate_hash_function("SHA1", hashlib.sha1, origin="hashlib") @@ -110,7 +110,6 @@ _generate_hash_function("SHA512", hashlib.sha512, origin="hashlib") for local_name, hash_name in ( ("RMD160", "ripemd160"), ("WHIRLPOOL", "whirlpool"), - # available since Python 3.6 ("BLAKE2B", "blake2b"), ("BLAKE2S", "blake2s"), ("SHA3_256", "sha3_256"), @@ -126,28 +125,6 @@ for local_name, hash_name in ( ) -# 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: - import sha3 - - _generate_hash_function("SHA3_256", sha3.sha3_256, origin="pysha3") - _generate_hash_function("SHA3_512", sha3.sha3_512, origin="pysha3") - except ImportError: - pass - - # Use pycrypto when available, prefer it over the internal fallbacks # Check for 'new' attributes, since they can be missing if the module # is broken somehow.