Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 1/2] vartree: Use hashlib lazy-import, kill py<2.5 compat
Date: Tue, 28 Feb 2017 10:12:21
Message-Id: 20170228101204.31808-2-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCHES] Fix md5 refs in vartree by "Michał Górny"
1 ---
2 pym/portage/dbapi/vartree.py | 9 +++------
3 1 file changed, 3 insertions(+), 6 deletions(-)
4
5 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
6 index 5053801e6..2a612d162 100644
7 --- a/pym/portage/dbapi/vartree.py
8 +++ b/pym/portage/dbapi/vartree.py
9 @@ -1,4 +1,4 @@
10 -# Copyright 1998-2014 Gentoo Foundation
11 +# Copyright 1998-2017 Gentoo Foundation
12 # Distributed under the terms of the GNU General Public License v2
13
14 from __future__ import division, unicode_literals
15 @@ -9,6 +9,7 @@ __all__ = [
16
17 import portage
18 portage.proxy.lazyimport.lazyimport(globals(),
19 + 'hashlib:md5',
20 'portage.checksum:_perform_md5_merge@perform_md5',
21 'portage.data:portage_gid,portage_uid,secpass',
22 'portage.dbapi.dep_expand:dep_expand',
23 @@ -1118,11 +1119,7 @@ class vardbapi(dbapi):
24 packages that own it. This is used to optimize owner lookups
25 by narrowing the search down to a smaller number of packages.
26 """
27 - try:
28 - from hashlib import md5 as _new_hash
29 - except ImportError:
30 - from md5 import new as _new_hash
31 -
32 + _new_hash = md5
33 _hash_bits = 16
34 _hex_chars = _hash_bits // 4
35
36 --
37 2.12.0