mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-17 18:50:11 +02:00
use common method to set up defaults in metadata dict
This is needed for the upcoming metadata formats: JSON, XML, etc.
This commit is contained in:
parent
141e0e24c7
commit
2b72634120
@ -560,6 +560,17 @@ def split_list_values(s):
|
|||||||
return [v for v in l if v]
|
return [v for v in l if v]
|
||||||
|
|
||||||
|
|
||||||
|
def get_default_app_info_list():
|
||||||
|
thisinfo = {}
|
||||||
|
thisinfo.update(app_defaults)
|
||||||
|
|
||||||
|
# General defaults...
|
||||||
|
thisinfo['builds'] = []
|
||||||
|
thisinfo['comments'] = []
|
||||||
|
|
||||||
|
return thisinfo
|
||||||
|
|
||||||
|
|
||||||
# Parse metadata for a single application.
|
# Parse metadata for a single application.
|
||||||
#
|
#
|
||||||
# 'metafile' - the filename to read. The package id for the application comes
|
# 'metafile' - the filename to read. The package id for the application comes
|
||||||
@ -661,20 +672,13 @@ def parse_txt_metadata(metafile):
|
|||||||
thisinfo['comments'].append((key, comment))
|
thisinfo['comments'].append((key, comment))
|
||||||
del curcomments[:]
|
del curcomments[:]
|
||||||
|
|
||||||
thisinfo = {}
|
thisinfo = get_default_app_info_list()
|
||||||
if metafile:
|
if metafile:
|
||||||
if not isinstance(metafile, file):
|
if not isinstance(metafile, file):
|
||||||
metafile = open(metafile, "r")
|
metafile = open(metafile, "r")
|
||||||
appid = metafile.name[9:-4]
|
appid = metafile.name[9:-4]
|
||||||
|
|
||||||
thisinfo.update(app_defaults)
|
|
||||||
thisinfo['id'] = appid
|
thisinfo['id'] = appid
|
||||||
|
else:
|
||||||
# General defaults...
|
|
||||||
thisinfo['builds'] = []
|
|
||||||
thisinfo['comments'] = []
|
|
||||||
|
|
||||||
if metafile is None:
|
|
||||||
return appid, thisinfo
|
return appid, thisinfo
|
||||||
|
|
||||||
mode = 0
|
mode = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user