eliminate app.builds everywhere, it should be app['Builds']

The .txt format was the last place where the lowercase "builds" was used,
this converts references everywhere to be "Builds".  This makes it possible
to load metadata YAML files with any YAML parser, then have it possible to
use fdroidserver methods on that data, like metadata.write_metadata().

The test files in tests/metadata/dump/*.yaml were manually edited by cutting
the builds: block and putting it the sort order for Builds: so the contents
should be unchanged.

```
sed -i \
 -e 's/app\.builds/app.get('Builds', \[\])/g' \
 -e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \
 -e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \
 -e "s/app\.get(Builds, \[\])/app.get('Builds', \[\])/g" \
 -e "s/app\.get('Builds', \[\])\.append/app\['Builds'\].append/g" \
 -e "s/app\['builds'\]/app.get('Builds', [])/g" \
 */*.*
```
This commit is contained in:
Hans-Christoph Steiner 2020-12-09 16:01:21 +01:00
parent 877779195f
commit bf25b4ca03
18 changed files with 275 additions and 279 deletions

View file

@ -1017,7 +1017,7 @@ def main():
apps = common.read_app_args(options.appid, allapps, True)
for appid, app in list(apps.items()):
if (app.Disabled and not options.force) or not app.RepoType or not app.builds:
if (app.get('Disabled') and not options.force) or not app.get('RepoType') or not app.get('Builds', []):
del apps[appid]
if not apps:
@ -1038,10 +1038,10 @@ def main():
if options.latest:
for app in apps.values():
for build in reversed(app.builds):
for build in reversed(app.get('Builds', [])):
if build.disable and not options.force:
continue
app.builds = [build]
app['Builds'] = [build]
break
if options.wiki:
@ -1062,7 +1062,7 @@ def main():
first = True
for build in app.builds:
for build in app.get('Builds', []):
if time.time() > endtime:
max_build_time_reached = True
break