index: rename app var to app_dict, its not an App instance

Throughout the code, variables named "app" are instances of the App class.
In this case, this is related, but it is a dict not an App instance, since
it is being prepared for including in the index-v1.json.
This commit is contained in:
Hans-Christoph Steiner 2023-05-03 19:20:45 +02:00
parent 8bc9a3da73
commit 024d309262
2 changed files with 13 additions and 13 deletions

View file

@ -843,10 +843,10 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
appslist = [] appslist = []
output['apps'] = appslist output['apps'] = appslist
for packageName, appdict in apps.items(): for packageName, app_dict in apps.items():
d = collections.OrderedDict() d = collections.OrderedDict()
appslist.append(d) appslist.append(d)
for k, v in sorted(appdict.items()): for k, v in sorted(app_dict.items()):
if not v: if not v:
continue continue
if k in ('Builds', 'metadatapath', if k in ('Builds', 'metadatapath',
@ -872,20 +872,20 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
d[k] = v d[k] = v
# establish sort order in lists, sets, and localized dicts # establish sort order in lists, sets, and localized dicts
for app in output['apps']: for app_dict in output['apps']:
localized = app.get('localized') localized = app_dict.get('localized')
if localized: if localized:
lordered = collections.OrderedDict() lordered = collections.OrderedDict()
for lkey, lvalue in sorted(localized.items()): for lkey, lvalue in sorted(localized.items()):
lordered[lkey] = collections.OrderedDict() lordered[lkey] = collections.OrderedDict()
for ikey, iname in sorted(lvalue.items()): for ikey, iname in sorted(lvalue.items()):
lordered[lkey][ikey] = iname lordered[lkey][ikey] = iname
app['localized'] = lordered app_dict['localized'] = lordered
antiFeatures = app.get('antiFeatures', []) antiFeatures = app_dict.get('antiFeatures', [])
if apps[app["packageName"]].get("NoSourceSince"): if apps[app_dict["packageName"]].get("NoSourceSince"):
antiFeatures.append("NoSourceSince") antiFeatures.append("NoSourceSince")
if antiFeatures: if antiFeatures:
app['antiFeatures'] = sorted(set(antiFeatures)) app_dict['antiFeatures'] = sorted(set(antiFeatures))
output_packages = collections.OrderedDict() output_packages = collections.OrderedDict()
output['packages'] = output_packages output['packages'] = output_packages
@ -1067,8 +1067,8 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing
root.appendChild(element) root.appendChild(element)
element.setAttribute('packageName', packageName) element.setAttribute('packageName', packageName)
for appid, appdict in apps.items(): for appid, app_dict in apps.items():
app = metadata.App(appdict) app = metadata.App(app_dict)
if app.get('Disabled') is not None: if app.get('Disabled') is not None:
continue continue

View file

@ -2343,10 +2343,10 @@ def main():
add_apks_to_per_app_repos(repodirs[0], apks) add_apks_to_per_app_repos(repodirs[0], apks)
for appid, app in apps.items(): for appid, app in apps.items():
repodir = os.path.join(appid, 'fdroid', 'repo') repodir = os.path.join(appid, 'fdroid', 'repo')
appdict = dict() app_dict = dict()
appdict[appid] = app app_dict[appid] = app
if os.path.isdir(repodir): if os.path.isdir(repodir):
index.make(appdict, apks, repodir, False) index.make(app_dict, apks, repodir, False)
else: else:
logging.info(_('Skipping index generation for {appid}').format(appid=appid)) logging.info(_('Skipping index generation for {appid}').format(appid=appid))
return return