gitlab-ci: check that localized metadata is properly named
This commit is contained in:
parent
01fc251255
commit
180a6c93af
|
@ -36,6 +36,7 @@ lint:
|
|||
- echo "these images have EXIF that must be stripped:"
|
||||
- git --no-pager diff --stat
|
||||
- git --no-pager diff --name-only --exit-code || export EXITVALUE=1
|
||||
- ./tools/check-localized-metadata.py || export EXITVALUE=1
|
||||
- ./tools/check-keyalias-collision.py || export EXITVALUE=1
|
||||
- exit $EXITVALUE
|
||||
|
||||
|
|
37
tools/check-localized-metadata.py
Executable file
37
tools/check-localized-metadata.py
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
os.chdir(os.path.dirname(__file__) + '/../')
|
||||
|
||||
count = 0
|
||||
|
||||
locales = dict()
|
||||
for f in sorted(glob.glob('metadata/*/*/*.txt')):
|
||||
name, _ = os.path.splitext(os.path.basename(f))
|
||||
if name == 'full_description':
|
||||
print(f, 'should use fdroid name', re.sub('full_description', 'description', f))
|
||||
count += 1
|
||||
elif name == 'short_description':
|
||||
print(f, 'should use fdroid name', re.sub('short_description', 'summary', f))
|
||||
count += 1
|
||||
elif name == 'title':
|
||||
print(f, 'should use fdroid name', re.sub('title', 'name', f))
|
||||
count += 1
|
||||
elif name not in ('summary', 'description', 'name'):
|
||||
print(f, 'has invalid filename', name)
|
||||
|
||||
packageName, locale = f.split('/')[1:3]
|
||||
if packageName not in locales:
|
||||
locales[packageName] = []
|
||||
locales[packageName].append(locale)
|
||||
|
||||
for k, v in locales.items():
|
||||
if 'en-US' not in v:
|
||||
print(k, 'is missing source locale en-US!')
|
||||
count += 1
|
||||
|
||||
sys.exit(count)
|
Loading…
Reference in a new issue