mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 14:30:11 +01:00
convert internal representation of AntiFeatures to list
The AntiFeatures metadata is a comma-separated list of tags, like Categories, so it should also be stored internally as a list. This makes parsing XML and JSON easier. The test cases' .pickle files look like they change a lot, but they really don't, its only the change of default AntiFeatures value from None to []
This commit is contained in:
parent
cc29d39f0a
commit
2831b3e93f
@ -42,7 +42,7 @@ class MetaDataException(Exception):
|
|||||||
# In the order in which they are laid out on files
|
# In the order in which they are laid out on files
|
||||||
app_defaults = OrderedDict([
|
app_defaults = OrderedDict([
|
||||||
('Disabled', None),
|
('Disabled', None),
|
||||||
('AntiFeatures', None),
|
('AntiFeatures', []),
|
||||||
('Provides', None),
|
('Provides', None),
|
||||||
('Categories', ['None']),
|
('Categories', ['None']),
|
||||||
('License', 'Unknown'),
|
('License', 'Unknown'),
|
||||||
@ -516,7 +516,7 @@ def read_metadata(xref=True):
|
|||||||
def metafieldtype(name):
|
def metafieldtype(name):
|
||||||
if name in ['Description', 'Maintainer Notes']:
|
if name in ['Description', 'Maintainer Notes']:
|
||||||
return 'multiline'
|
return 'multiline'
|
||||||
if name in ['Categories']:
|
if name in ['Categories', 'AntiFeatures']:
|
||||||
return 'list'
|
return 'list'
|
||||||
if name == 'Build Version':
|
if name == 'Build Version':
|
||||||
return 'build'
|
return 'build'
|
||||||
@ -929,7 +929,7 @@ def write_metadata(dest, app):
|
|||||||
|
|
||||||
mf = open(dest, 'w')
|
mf = open(dest, 'w')
|
||||||
writefield_nonempty('Disabled')
|
writefield_nonempty('Disabled')
|
||||||
writefield_nonempty('AntiFeatures')
|
writefield('AntiFeatures')
|
||||||
writefield_nonempty('Provides')
|
writefield_nonempty('Provides')
|
||||||
writefield('Categories')
|
writefield('Categories')
|
||||||
writefield('License')
|
writefield('License')
|
||||||
|
@ -256,8 +256,7 @@ def main():
|
|||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
if app['AntiFeatures'] is None:
|
if app['AntiFeatures'] is None:
|
||||||
continue
|
continue
|
||||||
antifeatures = [a.strip() for a in app['AntiFeatures'].split(',')]
|
for antifeature in app['AntiFeatures']:
|
||||||
for antifeature in antifeatures:
|
|
||||||
afs[antifeature] += 1
|
afs[antifeature] += 1
|
||||||
with open('stats/antifeatures.txt', 'w') as f:
|
with open('stats/antifeatures.txt', 'w') as f:
|
||||||
for antifeature, count in afs.most_common():
|
for antifeature, count in afs.most_common():
|
||||||
|
@ -92,8 +92,8 @@ def update_wiki(apps, sortedids, apks):
|
|||||||
wikidata = ''
|
wikidata = ''
|
||||||
if app['Disabled']:
|
if app['Disabled']:
|
||||||
wikidata += '{{Disabled|' + app['Disabled'] + '}}\n'
|
wikidata += '{{Disabled|' + app['Disabled'] + '}}\n'
|
||||||
if app['AntiFeatures']:
|
if 'AntiFeatures' in app:
|
||||||
for af in app['AntiFeatures'].split(','):
|
for af in app['AntiFeatures']:
|
||||||
wikidata += '{{AntiFeature|' + af + '}}\n'
|
wikidata += '{{AntiFeature|' + af + '}}\n'
|
||||||
wikidata += '{{App|id=%s|name=%s|added=%s|lastupdated=%s|source=%s|tracker=%s|web=%s|changelog=%s|donate=%s|flattr=%s|bitcoin=%s|litecoin=%s|dogecoin=%s|license=%s|root=%s}}\n' % (
|
wikidata += '{{App|id=%s|name=%s|added=%s|lastupdated=%s|source=%s|tracker=%s|web=%s|changelog=%s|donate=%s|flattr=%s|bitcoin=%s|litecoin=%s|dogecoin=%s|license=%s|root=%s}}\n' % (
|
||||||
appid,
|
appid,
|
||||||
@ -847,7 +847,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
|
|||||||
addElement('marketvercode', app['Current Version Code'], doc, apel)
|
addElement('marketvercode', app['Current Version Code'], doc, apel)
|
||||||
|
|
||||||
if app['AntiFeatures']:
|
if app['AntiFeatures']:
|
||||||
af = app['AntiFeatures'].split(',')
|
af = app['AntiFeatures']
|
||||||
if af:
|
if af:
|
||||||
addElementNonEmpty('antifeatures', ','.join(af), doc, apel)
|
addElementNonEmpty('antifeatures', ','.join(af), doc, apel)
|
||||||
if app['Provides']:
|
if app['Provides']:
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user