Clone of official tools

Revision:
43:2a7da56ebd24
Parent:
31:8ea194f6145b
--- a/arm_pack_manager/pack_manager.py	Mon Nov 06 13:17:14 2017 -0600
+++ b/arm_pack_manager/pack_manager.py	Tue Sep 25 13:43:09 2018 -0500
@@ -1,3 +1,4 @@
+from __future__ import print_function, division, absolute_import
 import argparse
 from os.path import basename
 from tools.arm_pack_manager import Cache
@@ -5,7 +6,7 @@
 from os import makedirs
 from itertools import takewhile
 from fuzzywuzzy import process
-from tools.arm_pack_manager import Cache
+from .arm_pack_manager import Cache
 
 parser = argparse.ArgumentParser(description='A Handy little utility for keeping your cache of pack files up to date.')
 subparsers = parser.add_subparsers(title="Commands")
@@ -69,7 +70,7 @@
         for key, value in process.extract(match, urls, limit=None) :
             choices.setdefault(key, 0)
             choices[key] += value
-    choices = sorted([(v, k) for k, v in choices.iteritems()], reverse=True)
+    choices = sorted([(v, k) for k, v in choices.items()], reverse=True)
     if not choices : return []
     elif len(choices) == 1 : return [choices[0][1]]
     elif choices[0][0] > choices[1][0] : choices = choices[:1]
@@ -133,12 +134,12 @@
         aliases = sum([fuzzy_find([m], cache.aliases.keys()) for m in matches], [])
     if print_parts:
         for part in choices :
-            print part
+            print(part)
             if long :
                 pp.pprint(cache.index[part])
     if print_aliases:
         for alias in aliases :
-            print alias
+            print(alias)
             if long :
                 pp.pprint(cache.index[cache.aliases[alias]])
 
@@ -155,7 +156,7 @@
     else :
         for part in parts :
             index.update(dict(cache.find_device(part)))
-    for n, p in index.iteritems() :
+    for n, p in index.items() :
         try :
             if not exists(join(out, dirname(p['algorithm']['file']))) :
                 makedirs(join(out, dirname(p['algorithm']['file'])))