From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH 2/3] checksum: Remove redundant internal fallbacks
Date: Tue, 28 Feb 2017 10:10:26 +0100 [thread overview]
Message-ID: <1488273026.1898.1.camel@gentoo.org> (raw)
In-Reply-To: <20170228090155.868-3-mgorny@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 2007 bytes --]
W dniu 28.02.2017, wto o godzinie 10∶01 +0100, użytkownik Michał Górny
napisał:
> Remove the internal digest fallbacks since they have no real use
> nowadays. The hashlib versions are preferred later in the logic anyway,
> and they are available since Python 2.5.
> ---
> pym/portage/checksum.py | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
> index 319252315..8b4d96e30 100644
> --- a/pym/portage/checksum.py
> +++ b/pym/portage/checksum.py
> @@ -18,8 +18,8 @@ import tempfile
> # most preferred first. Please keep this in sync with logic below.
> # ================================================================
> #
> -# MD5: python-fchksum, hashlib, mhash, hashlib/md5
> -# SHA1: hashlib, mhash, hashlib/sha1
> +# MD5: python-fchksum, hashlib, mhash
> +# SHA1: hashlib, mhash
> # SHA256: hashlib, pycrypto, mhash
> # SHA512: hashlib, mhash
> # RMD160: hashlib, pycrypto, mhash
> @@ -77,21 +77,6 @@ class _generate_hash_function(object):
> # Define hash functions, try to use the best module available. Later definitions
> # override earlier ones
>
> -# Use the internal modules as last fallback
> -try:
> - from hashlib import md5 as _new_md5
> -except ImportError:
> - from md5 import new as _new_md5
Ok, I see it now that there's still some dead code in Portage
referencing the _new_md5 thingy directly. I'll look into fixing that.
> -
> -md5hash = _generate_hash_function("MD5", _new_md5, origin="internal")
> -
> -try:
> - from hashlib import sha1 as _new_sha1
> -except ImportError:
> - from sha import new as _new_sha1
> -
> -sha1hash = _generate_hash_function("SHA1", _new_sha1, origin="internal")
> -
> # Try to use mhash if available
> # mhash causes GIL presently, so it gets less priority than hashlib and
> # pycrypto. However, it might be the only accelerated implementation of
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
next prev parent reply other threads:[~2017-02-28 9:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 9:01 [gentoo-portage-dev] [PATCHES] Little cleanup of checksum + BLAKE2*/SHA3 Michał Górny
2017-02-28 9:01 ` [gentoo-portage-dev] [PATCH 1/3] checksum: Add summary on top to help following the logic Michał Górny
2017-02-28 9:01 ` [gentoo-portage-dev] [PATCH 2/3] checksum: Remove redundant internal fallbacks Michał Górny
2017-02-28 9:10 ` Michał Górny [this message]
2017-02-28 9:01 ` [gentoo-portage-dev] [PATCH 3/3] checksum: Add blake2* and sha3 hashes from hashlib 3.6+ Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488273026.1898.1.camel@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox