mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-08-16 19:30:09 +02:00
make parse_yaml_metadata ignore empty input
This commit is contained in:
parent
e83221eb03
commit
0d005ab83a
@ -1075,25 +1075,24 @@ def parse_json_metadata(mf, app):
|
||||
def parse_yaml_metadata(mf, app):
|
||||
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:
|
||||
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)
|
||||
return app
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user