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