1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 10:40:12 +02:00

Replace iteritems() with items()

This commit is contained in:
Daniel Martí 2016-01-04 17:02:28 +01:00
parent 6819c109fe
commit 75419c1f04
9 changed files with 30 additions and 30 deletions

View 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

View 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))

View 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

View 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:

View 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

View 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):

View 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))

View 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)

View 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