mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-11 23:23:27 +02:00
Use dicts for field/flag types
This commit is contained in:
parent
cd4e43c3c2
commit
2c095df947
@ -212,21 +212,21 @@ TYPE_MULTILINE = 6
|
|||||||
TYPE_BUILD = 7
|
TYPE_BUILD = 7
|
||||||
TYPE_BUILD_V2 = 8
|
TYPE_BUILD_V2 = 8
|
||||||
|
|
||||||
|
fieldtypes = {
|
||||||
|
'Description': TYPE_MULTILINE,
|
||||||
|
'Maintainer Notes': TYPE_MULTILINE,
|
||||||
|
'Categories': TYPE_LIST,
|
||||||
|
'AntiFeatures': TYPE_LIST,
|
||||||
|
'Build Version': TYPE_BUILD,
|
||||||
|
'Build': TYPE_BUILD_V2,
|
||||||
|
'Use Built': TYPE_OBSOLETE,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def metafieldtype(name):
|
def metafieldtype(name):
|
||||||
if name in ['Description', 'Maintainer Notes']:
|
if name in fieldtypes:
|
||||||
return TYPE_MULTILINE
|
return fieldtypes[name]
|
||||||
if name in ['Categories', 'AntiFeatures']:
|
return TYPE_STRING
|
||||||
return TYPE_LIST
|
|
||||||
if name == 'Build Version':
|
|
||||||
return TYPE_BUILD
|
|
||||||
if name == 'Build':
|
|
||||||
return TYPE_BUILD_V2
|
|
||||||
if name == 'Use Built':
|
|
||||||
return TYPE_OBSOLETE
|
|
||||||
if name in app_fields:
|
|
||||||
return TYPE_STRING
|
|
||||||
return TYPE_UNKNOWN
|
|
||||||
|
|
||||||
|
|
||||||
# In the order in which they are laid out on files
|
# In the order in which they are laid out on files
|
||||||
@ -342,21 +342,33 @@ class Build():
|
|||||||
for f, v in d.iteritems():
|
for f, v in d.iteritems():
|
||||||
self.set_flag(f, v)
|
self.set_flag(f, v)
|
||||||
|
|
||||||
list_flags = set(['extlibs', 'srclibs', 'patch', 'rm', 'buildjni', 'preassemble',
|
flagtypes = {
|
||||||
'update', 'scanignore', 'scandelete', 'gradle', 'antcommands',
|
'extlibs': TYPE_LIST,
|
||||||
'gradleprops'])
|
'srclibs': TYPE_LIST,
|
||||||
script_flags = set(['init', 'prebuild', 'build'])
|
'patch': TYPE_LIST,
|
||||||
bool_flags = set(['submodules', 'oldsdkloc', 'forceversion', 'forcevercode',
|
'rm': TYPE_LIST,
|
||||||
'novcheck'])
|
'buildjni': TYPE_LIST,
|
||||||
|
'preassemble': TYPE_LIST,
|
||||||
|
'update': TYPE_LIST,
|
||||||
|
'scanignore': TYPE_LIST,
|
||||||
|
'scandelete': TYPE_LIST,
|
||||||
|
'gradle': TYPE_LIST,
|
||||||
|
'antcommands': TYPE_LIST,
|
||||||
|
'gradleprops': TYPE_LIST,
|
||||||
|
'init': TYPE_SCRIPT,
|
||||||
|
'prebuild': TYPE_SCRIPT,
|
||||||
|
'build': TYPE_SCRIPT,
|
||||||
|
'submodules': TYPE_BOOL,
|
||||||
|
'oldsdkloc': TYPE_BOOL,
|
||||||
|
'forceversion': TYPE_BOOL,
|
||||||
|
'forcevercode': TYPE_BOOL,
|
||||||
|
'novcheck': TYPE_BOOL,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def flagtype(name):
|
def flagtype(name):
|
||||||
if name in list_flags:
|
if name in flagtypes:
|
||||||
return TYPE_LIST
|
return flagtypes[name]
|
||||||
if name in script_flags:
|
|
||||||
return TYPE_SCRIPT
|
|
||||||
if name in bool_flags:
|
|
||||||
return TYPE_BOOL
|
|
||||||
return TYPE_STRING
|
return TYPE_STRING
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user