1 |
commit: 59c1b58469ee9bf0bd0158a0bdbd10defd872415 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 28 08:01:59 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 28 22:07:09 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=59c1b584 |
7 |
|
8 |
checksum: Remove redundant internal fallbacks |
9 |
|
10 |
Remove the internal digest fallbacks since they have no real use |
11 |
nowadays. The hashlib versions are preferred later in the logic anyway, |
12 |
and they are available since Python 2.5. |
13 |
|
14 |
pym/portage/checksum.py | 19 ++----------------- |
15 |
1 file changed, 2 insertions(+), 17 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py |
18 |
index 319252315..8b4d96e30 100644 |
19 |
--- a/pym/portage/checksum.py |
20 |
+++ b/pym/portage/checksum.py |
21 |
@@ -18,8 +18,8 @@ import tempfile |
22 |
# most preferred first. Please keep this in sync with logic below. |
23 |
# ================================================================ |
24 |
# |
25 |
-# MD5: python-fchksum, hashlib, mhash, hashlib/md5 |
26 |
-# SHA1: hashlib, mhash, hashlib/sha1 |
27 |
+# MD5: python-fchksum, hashlib, mhash |
28 |
+# SHA1: hashlib, mhash |
29 |
# SHA256: hashlib, pycrypto, mhash |
30 |
# SHA512: hashlib, mhash |
31 |
# RMD160: hashlib, pycrypto, mhash |
32 |
@@ -77,21 +77,6 @@ class _generate_hash_function(object): |
33 |
# Define hash functions, try to use the best module available. Later definitions |
34 |
# override earlier ones |
35 |
|
36 |
-# Use the internal modules as last fallback |
37 |
-try: |
38 |
- from hashlib import md5 as _new_md5 |
39 |
-except ImportError: |
40 |
- from md5 import new as _new_md5 |
41 |
- |
42 |
-md5hash = _generate_hash_function("MD5", _new_md5, origin="internal") |
43 |
- |
44 |
-try: |
45 |
- from hashlib import sha1 as _new_sha1 |
46 |
-except ImportError: |
47 |
- from sha import new as _new_sha1 |
48 |
- |
49 |
-sha1hash = _generate_hash_function("SHA1", _new_sha1, origin="internal") |
50 |
- |
51 |
# Try to use mhash if available |
52 |
# mhash causes GIL presently, so it gets less priority than hashlib and |
53 |
# pycrypto. However, it might be the only accelerated implementation of |