chiark / gitweb /
Replace iteritems() with items()
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 4 Jan 2016 16:02:28 +0000 (17:02 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 10 Mar 2016 16:43:37 +0000 (16:43 +0000)
fdroidserver/build.py
fdroidserver/checkupdates.py
fdroidserver/common.py
fdroidserver/install.py
fdroidserver/lint.py
fdroidserver/metadata.py
fdroidserver/rewritemeta.py
fdroidserver/scanner.py
fdroidserver/update.py

index cf12c34ed32856ec90c0cedbc64720f8ebcfb09a..b088d5260775bbbe8a179ac0b8b15e8e4b804f90 100644 (file)
@@ -462,7 +462,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
         if not ndk_path:
             logging.critical("Android NDK version '%s' could not be found!" % build.ndk or 'r10e')
             logging.critical("Configured versions:")
-            for k, v in config['ndk_paths'].iteritems():
+            for k, v in config['ndk_paths'].items():
                 if k.endswith("_orig"):
                     continue
                 logging.critical("  %s: %s" % (k, v))
@@ -1086,7 +1086,7 @@ def main():
     # Build applications...
     failed_apps = {}
     build_succeeded = []
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
 
         first = True
 
index 7d2100a3d078ee27d5fad1bb86501c2f7dc0df17..a285259de32409cd3b7c7777f01efcfaac975849 100644 (file)
@@ -554,7 +554,7 @@ def main():
                                      .format(common.getappname(app), version))
         return
 
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
 
         if options.autoonly and app.AutoUpdateMode in ('None', 'Static'):
             logging.debug("Nothing to do for {0}...".format(appid))
index 8f5350ffabb56742c6702e1138d766f346f4f93d..5acf7405b824f5ed900b1d00bf689c9e1fb198d1 100644 (file)
@@ -381,7 +381,7 @@ def read_app_args(args, allapps, allow_vercodes=False):
         return allapps
 
     apps = {}
-    for appid, app in allapps.iteritems():
+    for appid, app in allapps.items():
         if appid in vercodes:
             apps[appid] = app
 
@@ -394,7 +394,7 @@ def read_app_args(args, allapps, allow_vercodes=False):
         raise FDroidException("No packages specified")
 
     error = False
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
         vc = vercodes[appid]
         if not vc:
             continue
@@ -1519,7 +1519,7 @@ def getpaths_map(build_dir, globpaths):
 def getpaths(build_dir, globpaths):
     paths_map = getpaths_map(build_dir, globpaths)
     paths = set()
-    for k, v in paths_map.iteritems():
+    for k, v in paths_map.items():
         for p in v:
             paths.add(p)
     return paths
@@ -1551,7 +1551,7 @@ class KnownApks:
             os.mkdir('stats')
 
         lst = []
-        for apk, app in self.apks.iteritems():
+        for apk, app in self.apks.items():
             appid, added = app
             line = apk + ' ' + appid
             if added:
@@ -1582,7 +1582,7 @@ class KnownApks:
     # with the most recent first.
     def getlatest(self, num):
         apps = {}
-        for apk, app in self.apks.iteritems():
+        for apk, app in self.apks.items():
             appid, added = app
             if added:
                 if appid in apps:
@@ -1590,7 +1590,7 @@ class KnownApks:
                         apps[appid] = added
                 else:
                     apps[appid] = added
-        sortedapps = sorted(apps.iteritems(), key=operator.itemgetter(1))[-num:]
+        sortedapps = sorted(apps.items(), key=operator.itemgetter(1))[-num:]
         lst = [app for app, _ in sortedapps]
         lst.reverse()
         return lst
index ebb66232a1b2a65d05c583a6bb0f01eb4e091029..6921530159c15c65e0e93ecc927fe7eaacb80e09 100644 (file)
@@ -81,7 +81,7 @@ def main():
                 continue
             apks[appid] = apkfile
 
-        for appid, apk in apks.iteritems():
+        for appid, apk in apks.items():
             if not apk:
                 raise FDroidException("No signed apk available for %s" % appid)
 
@@ -90,7 +90,7 @@ def main():
         apks = {common.apknameinfo(apkfile)[0]: apkfile for apkfile in
                 sorted(glob.glob(os.path.join(output_dir, '*.apk')))}
 
-    for appid, apk in apks.iteritems():
+    for appid, apk in apks.items():
         # Get device list each time to avoid device not found errors
         devs = devices()
         if not devs:
index f02bb7ed98403c4438a995b912ed301bcafaf644..1bcb09ff40ff5b41cc969f27fe3ddd099e765bd6 100644 (file)
@@ -117,7 +117,7 @@ regex_checks = {
 
 
 def check_regexes(app):
-    for f, checks in regex_checks.iteritems():
+    for f, checks in regex_checks.items():
         for m, r in checks:
             v = app.get_field(f)
             t = metadata.fieldtype(f)
@@ -332,7 +332,7 @@ def main():
     allapps = metadata.read_metadata(xref=True)
     apps = common.read_app_args(options.appid, allapps, False)
 
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
         if app.Disabled:
             continue
 
index e5750cb7f819310b329e7a958be607d6989977c2..bf1d4dc4120ce1eb5861b86b513773276a8b813f 100644 (file)
@@ -158,11 +158,11 @@ class App():
     # names. Should only be used for tests.
     def field_dict(self):
         d = {}
-        for k, v in self.__dict__.iteritems():
+        for k, v in self.__dict__.items():
             if k == 'builds':
                 d['builds'] = []
                 for build in v:
-                    b = {k: v for k, v in build.__dict__.iteritems() if not k.startswith('_')}
+                    b = {k: v for k, v in build.__dict__.items() if not k.startswith('_')}
                     d['builds'].append(b)
             elif not k.startswith('_'):
                 f = App.attr_to_field(k)
@@ -196,7 +196,7 @@ class App():
 
     # Like dict.update(), but using human-readable field names
     def update_fields(self, d):
-        for f, v in d.iteritems():
+        for f, v in d.items():
             if f == 'builds':
                 for b in v:
                     build = Build()
@@ -354,7 +354,7 @@ class Build():
         return paths[version]
 
     def update_flags(self, d):
-        for f, v in d.iteritems():
+        for f, v in d.items():
             self.set_flag(f, v)
 
 flagtypes = {
@@ -793,7 +793,7 @@ def read_metadata(xref=True):
                 return ("fdroid.app:" + appid, "Dummy name - don't know yet")
             raise MetaDataException("Cannot resolve app id " + appid)
 
-        for appid, app in apps.iteritems():
+        for appid, app in apps.items():
             try:
                 description_html(app.Description, linkres)
             except MetaDataException as e:
@@ -842,14 +842,14 @@ esc_newlines = re.compile(r'\\( |\n)')
 # This function uses __dict__ to be faster
 def post_metadata_parse(app):
 
-    for k, v in app.__dict__.iteritems():
+    for k, v in app.__dict__.items():
         if k not in app._modified:
             continue
         if type(v) in (float, int):
             app.__dict__[k] = str(v)
 
     for build in app.builds:
-        for k, v in build.__dict__.iteritems():
+        for k, v in build.__dict__.items():
 
             if k not in build._modified:
                 continue
@@ -917,7 +917,7 @@ def _decode_list(data):
 def _decode_dict(data):
     '''convert items in a dict from unicode to basestring'''
     rv = {}
-    for k, v in data.iteritems():
+    for k, v in data.items():
         if isinstance(k, unicode):
             k = k.encode('utf-8')
         if isinstance(v, unicode):
index 407cb512c086b6c9e37566f6e719030ca039f5f5..e095410bec66a1872cbda765de3de5a25f30b153 100644 (file)
@@ -69,7 +69,7 @@ def main():
     if options.to is not None and options.to not in supported:
         parser.error("Must give a valid format to --to")
 
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
         base, ext = common.get_extension(app.metadatapath)
         if not options.to and ext not in supported:
             logging.info("Ignoring %s file at '%s'" % (ext, app.metadatapath))
index f5a7e8fc07240ef7548ead4d61e451eff5a30359..76eb73eac66f9e23b328fa6cd3e5f37973525dc1 100644 (file)
@@ -67,7 +67,7 @@ def scan_source(build_dir, root_dir, build):
     }
 
     def suspects_found(s):
-        for n, r in usual_suspects.iteritems():
+        for n, r in usual_suspects.items():
             if r.match(s):
                 yield n
 
@@ -94,7 +94,7 @@ def scan_source(build_dir, root_dir, build):
     scandelete_worked = set()
 
     def toignore(fd):
-        for k, paths in scanignore.iteritems():
+        for k, paths in scanignore.items():
             for p in paths:
                 if fd.startswith(p):
                     scanignore_worked.add(k)
@@ -102,7 +102,7 @@ def scan_source(build_dir, root_dir, build):
         return False
 
     def todelete(fd):
-        for k, paths in scandelete.iteritems():
+        for k, paths in scandelete.items():
             for p in paths:
                 if fd.startswith(p):
                     scandelete_worked.add(k)
@@ -266,7 +266,7 @@ def main():
     srclib_dir = os.path.join(build_dir, 'srclib')
     extlib_dir = os.path.join(build_dir, 'extlib')
 
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
 
         if app.Disabled:
             logging.info("Skipping %s: disabled" % appid)
index d46ae70da9acd5eb4b5fd35256eb976ba909dd6c..6a9bc0637697680271edd5a16b267d27d2f34bee 100644 (file)
@@ -291,7 +291,7 @@ def delete_disabled_builds(apps, apkcache, repodirs):
     :param apkcache: current apk cache information
     :param repodirs: the repo directories to process
     """
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
         for build in app.builds:
             if not build.disable:
                 continue
@@ -1024,7 +1024,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
 
 def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversions):
 
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
 
         if app.ArchivePolicy:
             keepversions = int(app.ArchivePolicy[:-9])
@@ -1268,7 +1268,7 @@ def main():
     # level. When doing this, we use the info from the most recent version's apk.
     # We deal with figuring out when the app was added and last updated at the
     # same time.
-    for appid, app in apps.iteritems():
+    for appid, app in apps.items():
         bestver = 0
         for apk in apks + archapks:
             if apk['id'] == appid:
@@ -1308,7 +1308,7 @@ def main():
     # per-app subscription feeds for nightly builds and things like it
     if config['per_app_repos']:
         add_apks_to_per_app_repos(repodirs[0], apks)
-        for appid, app in apps.iteritems():
+        for appid, app in apps.items():
             repodir = os.path.join(appid, 'fdroid', 'repo')
             appdict = dict()
             appdict[appid] = app