mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
Centralise management of srclib metadata
This commit is contained in:
parent
e29da6b023
commit
3a73654d49
4 changed files with 31 additions and 10 deletions
|
|
@ -23,7 +23,7 @@ import glob
|
|||
import cgi
|
||||
import logging
|
||||
|
||||
srclibs = []
|
||||
srclibs = {}
|
||||
|
||||
class MetaDataException(Exception):
|
||||
def __init__(self, value):
|
||||
|
|
@ -421,6 +421,28 @@ def parse_srclib(metafile):
|
|||
return thisinfo
|
||||
|
||||
|
||||
def read_srclibs():
|
||||
"""Read all srclib metadata.
|
||||
|
||||
The information read will be accessible as metadata.srclibs, which is a
|
||||
dictionary, keyed on srclib name, with the values each being a dictionary
|
||||
in the same format as that returned by the parse_srclib function.
|
||||
|
||||
A MetaDataException is raised if there are any problems with the srclib
|
||||
metadata.
|
||||
"""
|
||||
global srclibs
|
||||
srclibs = {}
|
||||
|
||||
srcdir = 'srclibs'
|
||||
if not os.path.exists(srcdir):
|
||||
os.makedirs(srcdir)
|
||||
|
||||
for metafile in sorted(glob.glob(os.path.join(srcdir, '*.txt'))):
|
||||
srclibname = os.path.basename(metafile[:-4])
|
||||
srclibs[srclibname] = parse_srclib(metafile)
|
||||
|
||||
|
||||
# Read all metadata. Returns a list of 'app' objects (which are dictionaries as
|
||||
# returned by the parse_metadata function.
|
||||
def read_metadata(xref=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue