commit:     986ef3f2a80c688059840d781d962bd3f3644538
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 12 02:18:17 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Oct 12 02:18:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=986ef3f2

genbase: use sorted() with dict keys

In py3, the dict keys func returns a view which doesn't have a sort
member.  Pass the result through sorted() which works with py2 and
py3.

 catalyst/base/genbase.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index a33f924..8a1af8d 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -22,8 +22,7 @@ class GenBase(object):
                                keys={}
                                for i in self.settings["contents"].split():
                                        keys[i]=1
-                                       array=keys.keys()
-                                       array.sort()
+                                       array = sorted(keys.keys())
                                for j in array:
                                        contents = contents_map.contents(path, 
j,
                                                
verbose=self.settings["VERBOSE"])
@@ -42,8 +41,7 @@ class GenBase(object):
                                keys={}
                                for i in self.settings["digests"].split():
                                        keys[i]=1
-                                       array=keys.keys()
-                                       array.sort()
+                                       array = sorted(keys.keys())
                                for f in [path, path + '.CONTENTS']:
                                        if os.path.exists(f):
                                                if "all" in array:

Reply via email to