mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-06 01:11:07 +03:00
preserve order and formatting on creating Metadata from Yaml template (closes #352)
This commit is contained in:
parent
b787ec9e34
commit
cbd420e490
1 changed files with 15 additions and 8 deletions
|
@ -1771,8 +1771,15 @@ def main():
|
||||||
# special tricks are not really needed here, this
|
# special tricks are not really needed here, this
|
||||||
# uses the plain YAML lib
|
# uses the plain YAML lib
|
||||||
if os.path.exists('template.yml'):
|
if os.path.exists('template.yml'):
|
||||||
with open('template.yml') as fp:
|
with open('template.yml') as f:
|
||||||
app = yaml.load(fp)
|
metatxt = f.read()
|
||||||
|
if 'name' in apk and apk['name'] != '':
|
||||||
|
metatxt = re.sub(r'^(((Auto)?Name|Summary):).*$', r'\1 ' + apk['name'], metatxt, flags=re.IGNORECASE | re.MULTILINE)
|
||||||
|
else:
|
||||||
|
logging.warning(apk['packageName'] + ' does not have a name! Using package name instead.')
|
||||||
|
metatxt = re.sub(r'^(((Auto)?Name|Summary):).*$', r'\1 ' + apk['packageName'], metatxt, flags=re.IGNORECASE | re.MULTILINE)
|
||||||
|
with open(os.path.join('metadata', apk['packageName'] + '.yml'), 'w') as f:
|
||||||
|
f.write(metatxt)
|
||||||
else:
|
else:
|
||||||
app = dict()
|
app = dict()
|
||||||
app['Categories'] = [os.path.basename(os.getcwd())]
|
app['Categories'] = [os.path.basename(os.getcwd())]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue