mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
make parse_yaml_metadata ignore empty input
This commit is contained in:
parent
e83221eb03
commit
0d005ab83a
1 changed files with 17 additions and 18 deletions
|
|
@ -1075,25 +1075,24 @@ def parse_json_metadata(mf, app):
|
||||||
def parse_yaml_metadata(mf, app):
|
def parse_yaml_metadata(mf, app):
|
||||||
yamldata = yaml.load(mf, Loader=YamlLoader)
|
yamldata = yaml.load(mf, Loader=YamlLoader)
|
||||||
|
|
||||||
for field in yamldata:
|
|
||||||
if field not in yaml_app_fields:
|
|
||||||
warn_or_exception(_('Unrecognised app field: {fieldname}')
|
|
||||||
.format(fieldname=field))
|
|
||||||
if not yamldata.get('Builds', None):
|
|
||||||
warn_or_exception(_('Missing app field: {fieldname}')
|
|
||||||
.format(fieldname='Builds'))
|
|
||||||
for build in yamldata.get('Builds', []):
|
|
||||||
# put all build flag keywords into a set to avoid
|
|
||||||
# excessive looping action
|
|
||||||
build_flag_set = set()
|
|
||||||
for build_flag in build.keys():
|
|
||||||
build_flag_set.add(build_flag)
|
|
||||||
for build_flag in build_flag_set:
|
|
||||||
if build_flag not in build_flags:
|
|
||||||
warn_or_exception(_('Unrecognised build flag: {build_flag}')
|
|
||||||
.format(build_flag=build_flag))
|
|
||||||
|
|
||||||
if yamldata:
|
if yamldata:
|
||||||
|
for field in yamldata:
|
||||||
|
if field not in yaml_app_fields:
|
||||||
|
warn_or_exception(_('Unrecognised app field: {fieldname}')
|
||||||
|
.format(fieldname=field))
|
||||||
|
if not yamldata.get('Builds', None):
|
||||||
|
warn_or_exception(_('Missing app field: {fieldname}')
|
||||||
|
.format(fieldname='Builds'))
|
||||||
|
for build in yamldata.get('Builds', []):
|
||||||
|
# put all build flag keywords into a set to avoid
|
||||||
|
# excessive looping action
|
||||||
|
build_flag_set = set()
|
||||||
|
for build_flag in build.keys():
|
||||||
|
build_flag_set.add(build_flag)
|
||||||
|
for build_flag in build_flag_set:
|
||||||
|
if build_flag not in build_flags:
|
||||||
|
warn_or_exception(_('Unrecognised build flag: {build_flag}')
|
||||||
|
.format(build_flag=build_flag))
|
||||||
app.update(yamldata)
|
app.update(yamldata)
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue