commit: ef1860e39a634696eb6e457cb0cafba95324f53f
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 28 09:27:08 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Feb 28 22:07:08 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef1860e3
vartree: Use hashlib lazy-import, kill py<2.5 compat
pym/portage/dbapi/vartree.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 5053801e6..2a612d162 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2014 Gentoo Foundation
+# Copyright 1998-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import division, unicode_literals
@@ -9,6 +9,7 @@ __all__ = [
import portage
portage.proxy.lazyimport.lazyimport(globals(),
+ 'hashlib:md5',
'portage.checksum:_perform_md5_merge@perform_md5',
'portage.data:portage_gid,portage_uid,secpass',
'portage.dbapi.dep_expand:dep_expand',
@@ -1118,11 +1119,7 @@ class vardbapi(dbapi):
packages that own it. This is used to optimize owner lookups
by narrowing the search down to a smaller number of packages.
"""
- try:
- from hashlib import md5 as _new_hash
- except ImportError:
- from md5 import new as _new_hash
-
+ _new_hash = md5
_hash_bits = 16
_hex_chars = _hash_bits // 4