Gentoo Archives: gentoo-catalyst

From: Mike Frysinger <vapier@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 5/9] genbase: use sorted() with dict keys
Date: Mon, 12 Oct 2015 04:36:14
Message-Id: 1444624562-26162-5-git-send-email-vapier@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 1/9] convert octals to py3 compat by Mike Frysinger
1 In py3, the dict keys func returns a view which doesn't have a sort
2 member. Pass the result through sorted() which works with py2 and
3 py3.
4 ---
5 catalyst/base/genbase.py | 6 ++----
6 1 file changed, 2 insertions(+), 4 deletions(-)
7
8 diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
9 index a33f924..8a1af8d 100644
10 --- a/catalyst/base/genbase.py
11 +++ b/catalyst/base/genbase.py
12 @@ -22,8 +22,7 @@ class GenBase(object):
13 keys={}
14 for i in self.settings["contents"].split():
15 keys[i]=1
16 - array=keys.keys()
17 - array.sort()
18 + array = sorted(keys.keys())
19 for j in array:
20 contents = contents_map.contents(path, j,
21 verbose=self.settings["VERBOSE"])
22 @@ -42,8 +41,7 @@ class GenBase(object):
23 keys={}
24 for i in self.settings["digests"].split():
25 keys[i]=1
26 - array=keys.keys()
27 - array.sort()
28 + array = sorted(keys.keys())
29 for f in [path, path + '.CONTENTS']:
30 if os.path.exists(f):
31 if "all" in array:
32 --
33 2.5.2