mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-08 18:31:07 +03:00
enable user to have presets for metadata by using a template.yml (see #345)
This commit is contained in:
parent
732de91aa7
commit
4d375a585d
1 changed files with 6 additions and 2 deletions
|
@ -1760,13 +1760,18 @@ def main():
|
||||||
for apk in apks:
|
for apk in apks:
|
||||||
if apk['packageName'] not in apps:
|
if apk['packageName'] not in apps:
|
||||||
if options.create_metadata:
|
if options.create_metadata:
|
||||||
|
import yaml
|
||||||
with open(os.path.join('metadata', apk['packageName'] + '.yml'), 'w') as f:
|
with open(os.path.join('metadata', apk['packageName'] + '.yml'), 'w') as f:
|
||||||
# this should use metadata.App() and
|
# this should use metadata.App() and
|
||||||
# metadata.write_yaml(), but since ruamel.yaml
|
# metadata.write_yaml(), but since ruamel.yaml
|
||||||
# 0.13 is not widely distributed yet, and it's
|
# 0.13 is not widely distributed yet, and it's
|
||||||
# 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
|
||||||
app = dict()
|
if os.path.exists('template.yml'):
|
||||||
|
with open('template.yml') as fp:
|
||||||
|
app = yaml.load(fp)
|
||||||
|
else:
|
||||||
|
app = dict()
|
||||||
if 'name' in apk and apk['name'] != '':
|
if 'name' in apk and apk['name'] != '':
|
||||||
app['Name'] = apk['name']
|
app['Name'] = apk['name']
|
||||||
else:
|
else:
|
||||||
|
@ -1780,7 +1785,6 @@ def main():
|
||||||
app['IssueTracker'] = ''
|
app['IssueTracker'] = ''
|
||||||
app['SourceCode'] = ''
|
app['SourceCode'] = ''
|
||||||
app['CurrentVersionCode'] = 2147483647 # Java's Integer.MAX_VALUE
|
app['CurrentVersionCode'] = 2147483647 # Java's Integer.MAX_VALUE
|
||||||
import yaml
|
|
||||||
yaml.dump(app, f, default_flow_style=False)
|
yaml.dump(app, f, default_flow_style=False)
|
||||||
logging.info("Generated skeleton metadata for " + apk['packageName'])
|
logging.info("Generated skeleton metadata for " + apk['packageName'])
|
||||||
newmetadata = True
|
newmetadata = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue