mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-17 18:50:11 +02:00
Never use exit/log in metadata
This commit is contained in:
parent
b9ac6fb69a
commit
96f1fc5355
@ -20,10 +20,8 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import glob
|
import glob
|
||||||
import cgi
|
import cgi
|
||||||
import logging
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
@ -889,10 +887,8 @@ def parse_metadata(metadatapath):
|
|||||||
_, ext = common.get_extension(metadatapath)
|
_, ext = common.get_extension(metadatapath)
|
||||||
accepted = common.config['accepted_formats']
|
accepted = common.config['accepted_formats']
|
||||||
if ext not in accepted:
|
if ext not in accepted:
|
||||||
logging.critical('"' + metadatapath
|
raise MetaDataException('"%s" is not an accepted format, convert to: %s' % (
|
||||||
+ '" is not in an accepted format, '
|
metadatapath, ', '.join(accepted)))
|
||||||
+ 'convert to: ' + ', '.join(accepted))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
app = None
|
app = None
|
||||||
if ext == 'txt':
|
if ext == 'txt':
|
||||||
@ -904,8 +900,7 @@ def parse_metadata(metadatapath):
|
|||||||
elif ext == 'yaml':
|
elif ext == 'yaml':
|
||||||
app = parse_yaml_metadata(metadatapath)
|
app = parse_yaml_metadata(metadatapath)
|
||||||
else:
|
else:
|
||||||
logging.critical('Unknown metadata format: ' + metadatapath)
|
raise MetaDataException('Unknown metadata format: %s' % metadatapath)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
post_metadata_parse(app)
|
post_metadata_parse(app)
|
||||||
return app
|
return app
|
||||||
@ -934,8 +929,7 @@ def parse_xml_metadata(metadatapath):
|
|||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
|
|
||||||
if root.tag != 'resources':
|
if root.tag != 'resources':
|
||||||
logging.critical(metadatapath + ' does not have root as <resources></resources>!')
|
raise MetaDataException('%s does not have root as <resources></resources>!' % metadatapath)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
for child in root:
|
for child in root:
|
||||||
if child.tag != 'builds':
|
if child.tag != 'builds':
|
||||||
|
Loading…
Reference in New Issue
Block a user