X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=fdroidserver%2Fmetadata.py;h=fe45c896aa274983bcdd1a8234038859f874af08;hb=32e257d742c8d6dc1cd93da1b716979a71758180;hp=038c6a84cd6f9653ea7bf6596c18c3508bdcce6c;hpb=0b62e7f22a4760c29c09e8132529e44f32ec7669;p=fdroidserver.git diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index 038c6a84..fe45c896 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -25,6 +25,15 @@ import glob import cgi import logging +import yaml +# use libyaml if it is available +try: + from yaml import CLoader + YamlLoader = CLoader +except ImportError: + from yaml import Loader + YamlLoader = Loader + # use the C implementation when available import xml.etree.cElementTree as ElementTree @@ -500,6 +509,11 @@ def read_metadata(xref=True): check_metadata(appinfo) apps[appid] = appinfo + for metafile in sorted(glob.glob(os.path.join('metadata', '*.yaml'))): + appid, appinfo = parse_yaml_metadata(metafile) + check_metadata(appinfo) + apps[appid] = appinfo + if xref: # Parse all descriptions at load time, just to ensure cross-referencing # errors are caught early rather than when they hit the build server. @@ -774,6 +788,18 @@ def parse_xml_metadata(metafile): return (appid, thisinfo) +def parse_yaml_metadata(metafile): + + appid = os.path.basename(metafile)[0:-5] # strip path and .yaml + thisinfo = get_default_app_info_list(appid) + + yamlinfo = yaml.load(open(metafile, 'r'), Loader=YamlLoader) + thisinfo.update(yamlinfo) + post_metadata_parse(thisinfo) + + return (appid, thisinfo) + + def parse_txt_metadata(metafile): appid = None