1 |
W dniu 28.02.2017, wto o godzinie 10∶01 +0100, użytkownik Michał Górny |
2 |
napisał: |
3 |
> Remove the internal digest fallbacks since they have no real use |
4 |
> nowadays. The hashlib versions are preferred later in the logic anyway, |
5 |
> and they are available since Python 2.5. |
6 |
> --- |
7 |
> pym/portage/checksum.py | 19 ++----------------- |
8 |
> 1 file changed, 2 insertions(+), 17 deletions(-) |
9 |
> |
10 |
> diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py |
11 |
> index 319252315..8b4d96e30 100644 |
12 |
> --- a/pym/portage/checksum.py |
13 |
> +++ b/pym/portage/checksum.py |
14 |
> @@ -18,8 +18,8 @@ import tempfile |
15 |
> # most preferred first. Please keep this in sync with logic below. |
16 |
> # ================================================================ |
17 |
> # |
18 |
> -# MD5: python-fchksum, hashlib, mhash, hashlib/md5 |
19 |
> -# SHA1: hashlib, mhash, hashlib/sha1 |
20 |
> +# MD5: python-fchksum, hashlib, mhash |
21 |
> +# SHA1: hashlib, mhash |
22 |
> # SHA256: hashlib, pycrypto, mhash |
23 |
> # SHA512: hashlib, mhash |
24 |
> # RMD160: hashlib, pycrypto, mhash |
25 |
> @@ -77,21 +77,6 @@ class _generate_hash_function(object): |
26 |
> # Define hash functions, try to use the best module available. Later definitions |
27 |
> # override earlier ones |
28 |
> |
29 |
> -# Use the internal modules as last fallback |
30 |
> -try: |
31 |
> - from hashlib import md5 as _new_md5 |
32 |
> -except ImportError: |
33 |
> - from md5 import new as _new_md5 |
34 |
|
35 |
Ok, I see it now that there's still some dead code in Portage |
36 |
referencing the _new_md5 thingy directly. I'll look into fixing that. |
37 |
|
38 |
> - |
39 |
> -md5hash = _generate_hash_function("MD5", _new_md5, origin="internal") |
40 |
> - |
41 |
> -try: |
42 |
> - from hashlib import sha1 as _new_sha1 |
43 |
> -except ImportError: |
44 |
> - from sha import new as _new_sha1 |
45 |
> - |
46 |
> -sha1hash = _generate_hash_function("SHA1", _new_sha1, origin="internal") |
47 |
> - |
48 |
> # Try to use mhash if available |
49 |
> # mhash causes GIL presently, so it gets less priority than hashlib and |
50 |
> # pycrypto. However, it might be the only accelerated implementation of |
51 |
|
52 |
-- |
53 |
Best regards, |
54 |
Michał Górny |