mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-19 03:30:12 +02:00
Make comma-separated list parsing code common
This commit is contained in:
parent
76332e7c0e
commit
ac004264f0
@ -1154,7 +1154,7 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None,
|
|||||||
|
|
||||||
if srclib["Srclibs"]:
|
if srclib["Srclibs"]:
|
||||||
n = 1
|
n = 1
|
||||||
for lib in srclib["Srclibs"].replace(';', ',').split(','):
|
for lib in metadata.split_list_values(srclib["Srclibs"]):
|
||||||
s_tuple = None
|
s_tuple = None
|
||||||
for t in srclibpaths:
|
for t in srclibpaths:
|
||||||
if t[0] == lib:
|
if t[0] == lib:
|
||||||
|
@ -552,6 +552,12 @@ def fill_build_defaults(build):
|
|||||||
build['ndk_path'] = common.get_ndk_path(build['ndk'])
|
build['ndk_path'] = common.get_ndk_path(build['ndk'])
|
||||||
|
|
||||||
|
|
||||||
|
def split_list_values(s):
|
||||||
|
# Port legacy ';' separators
|
||||||
|
l = [v.strip() for v in s.replace(';', ',').split(',')]
|
||||||
|
return [v for v in l if v]
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
@ -597,8 +603,7 @@ def parse_metadata(metafile):
|
|||||||
.format(p, linedesc))
|
.format(p, linedesc))
|
||||||
t = flagtype(pk)
|
t = flagtype(pk)
|
||||||
if t == 'list':
|
if t == 'list':
|
||||||
# Port legacy ';' separators
|
pv = split_list_values(pv)
|
||||||
pv = [v.strip() for v in pv.replace(';', ',').split(',')]
|
|
||||||
if pk == 'gradle':
|
if pk == 'gradle':
|
||||||
if len(pv) == 1 and pv[0] in ['main', 'yes']:
|
if len(pv) == 1 and pv[0] in ['main', 'yes']:
|
||||||
pv = ['yes']
|
pv = ['yes']
|
||||||
@ -727,7 +732,7 @@ def parse_metadata(metafile):
|
|||||||
elif fieldtype == 'string':
|
elif fieldtype == 'string':
|
||||||
thisinfo[field] = value
|
thisinfo[field] = value
|
||||||
elif fieldtype == 'list':
|
elif fieldtype == 'list':
|
||||||
thisinfo[field] = [v.strip() for v in value.replace(';', ',').split(',')]
|
thisinfo[field] = split_list_values(value)
|
||||||
elif fieldtype == 'build':
|
elif fieldtype == 'build':
|
||||||
if value.endswith("\\"):
|
if value.endswith("\\"):
|
||||||
mode = 2
|
mode = 2
|
||||||
|
Loading…
Reference in New Issue
Block a user