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

update: use "app" as dict not App instance in apply_info_from_latest_apk

This allows update.apply_info_from_latest_apk() to be used as part of the
API.  This way "app" can be a dict or an App instance.
This commit is contained in:
Hans-Christoph Steiner 2020-10-01 10:04:30 +02:00
parent 283f10dec1
commit 790b5a2888
2 changed files with 12 additions and 12 deletions

View File

@ -61,7 +61,7 @@ def make(apps, apks, repodir, archive):
common.assert_config_keystore(common.config) common.assert_config_keystore(common.config)
# Historically the index has been sorted by App Name, so we enforce this ordering here # Historically the index has been sorted by App Name, so we enforce this ordering here
sortedids = sorted(apps, key=lambda appid: apps[appid].Name.upper()) sortedids = sorted(apps, key=lambda appid: apps[appid]['Name'].upper())
sortedapps = collections.OrderedDict() sortedapps = collections.OrderedDict()
for appid in sortedids: for appid in sortedids:
sortedapps[appid] = apps[appid] sortedapps[appid] = apps[appid]

View File

@ -1971,26 +1971,26 @@ def apply_info_from_latest_apk(apps, apks):
bestver = apk['versionCode'] bestver = apk['versionCode']
bestapk = apk bestapk = apk
if app.NoSourceSince: if app['NoSourceSince']:
apk['antiFeatures'].add('NoSourceSince') apk['antiFeatures'].add('NoSourceSince')
if not app.added: if not app['added']:
logging.debug("Don't know when " + appid + " was added") logging.debug("Don't know when " + appid + " was added")
if not app.lastUpdated: if not app['lastUpdated']:
logging.debug("Don't know when " + appid + " was last updated") logging.debug("Don't know when " + appid + " was last updated")
if bestver == UNSET_VERSION_CODE: if bestver == UNSET_VERSION_CODE:
if app.Name is None: if app['Name'] is None:
app.Name = app.AutoName or appid app['Name'] = app['AutoName'] or appid
app.icon = None app['icon'] = None
logging.debug("Application " + appid + " has no packages") logging.debug("Application " + appid + " has no packages")
else: else:
if app.Name is None: if app['Name'] is None:
app.Name = bestapk['name'] app['Name'] = bestapk['name']
app.icon = bestapk['icon'] if 'icon' in bestapk else None app['icon'] = bestapk['icon'] if 'icon' in bestapk else None
if app.CurrentVersionCode is None: if app['CurrentVersionCode'] is None:
app.CurrentVersionCode = str(bestver) app['CurrentVersionCode'] = str(bestver)
def make_categories_txt(repodir, categories): def make_categories_txt(repodir, categories):