diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index 5b4aa433..72678434 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -58,54 +58,6 @@ def warn_or_exception(value, cause=None): logging.warning(value) -# To filter which ones should be written to the metadata files if -# present -app_fields = set([ - 'Disabled', - 'AntiFeatures', - 'Provides', # deprecated, txt only - 'Categories', - 'License', - 'Author Name', - 'Author Email', - 'Author Web Site', - 'Web Site', - 'Source Code', - 'Issue Tracker', - 'Translation', - 'Changelog', - 'Donate', - 'FlattrID', - 'Liberapay', - 'LiberapayID', - 'OpenCollective', - 'Bitcoin', - 'Litecoin', - 'Name', - 'Auto Name', - 'Summary', - 'Description', - 'Requires Root', - 'Repo Type', - 'Repo', - 'Binaries', - 'Maintainer Notes', - 'Archive Policy', - 'Auto Update Mode', - 'Update Check Mode', - 'Update Check Ignore', - 'Vercode Operation', - 'Update Check Name', - 'Update Check Data', - 'Current Version', - 'Current Version Code', - 'No Source Since', - 'Build', - - 'comments', # For formats that don't do inline comments - 'builds', # For formats that do builds as a list -]) - yaml_app_field_order = [ 'Disabled', 'AntiFeatures', @@ -265,7 +217,9 @@ def fieldtype(name): # In the order in which they are laid out on files -build_flags_order = [ +build_flags = [ + 'versionName', + 'versionCode', 'disable', 'commit', 'timeout', @@ -300,10 +254,6 @@ build_flags_order = [ 'antifeatures', ] -# old .txt format has version name/code inline in the 'Build:' line -# but YAML and JSON have a explicit key for them -build_flags = ['versionName', 'versionCode'] + build_flags_order - class Build(dict): @@ -690,16 +640,6 @@ class DescriptionFormatter: self.html.close() -# Parse multiple lines of description as written in a metadata file, returning -# a single string in text format and wrapped to 80 columns. -def description_txt(s): - ps = DescriptionFormatter(None) - for line in s.splitlines(): - ps.parseline(line) - ps.end() - return ps.text_txt - - # Parse multiple lines of description as written in a metadata file, returning # a single string in wiki format. Used for the Maintainer Notes field as well, # because it's the same format. @@ -846,11 +786,6 @@ def read_metadata(xref=True, check_vcs=[], refresh=True, sort_by_time=False): sorted based on creation time, newest first. Most of the time, the newer files are the most interesting. - If there are multiple metadata files for a single appid, then the first - file that is parsed wins over all the others, and the rest throw an - exception. So the original .txt format is parsed first, at least until - newer formats stabilize. - check_vcs is the list of appids to check for .fdroid.yml in source """ @@ -865,9 +800,7 @@ def read_metadata(xref=True, check_vcs=[], refresh=True, sort_by_time=False): if not os.path.exists(basedir): os.makedirs(basedir) - metadatafiles = (glob.glob(os.path.join('metadata', '*.txt')) - + glob.glob(os.path.join('metadata', '*.yml')) - + glob.glob('.fdroid.txt') + metadatafiles = (glob.glob(os.path.join('metadata', '*.yml')) + glob.glob('.fdroid.yml')) if sort_by_time: @@ -880,8 +813,6 @@ def read_metadata(xref=True, check_vcs=[], refresh=True, sort_by_time=False): metadatafiles = sorted(metadatafiles) for metadatapath in metadatafiles: - if metadatapath == '.fdroid.txt': - warn_or_exception(_('.fdroid.txt is not supported! Convert to .fdroid.yml')) appid, _ignored = fdroidserver.common.get_extension(os.path.basename(metadatapath)) if appid != '.fdroid' and not fdroidserver.common.is_valid_package_name(appid): warn_or_exception(_("{appid} from {path} is not a valid Java Package Name!") @@ -1054,14 +985,12 @@ def parse_metadata(metadatapath, check_vcs=False, refresh=True): else: app.id = name - with open(metadatapath, 'r') as mf: - if ext == 'txt': - parse_txt_metadata(mf, app) - elif ext == 'yml': + if ext == 'yml': + with open(metadatapath, 'r') as mf: parse_yaml_metadata(mf, app) - else: - warn_or_exception(_('Unknown metadata format: {path}') - .format(path=metadatapath)) + else: + warn_or_exception(_('Unknown metadata format: {path}') + .format(path=metadatapath)) if check_vcs and app.Repo: build_dir = fdroidserver.common.get_build_dir(app) @@ -1235,7 +1164,7 @@ def write_yaml(mf, app): insert_newline = True else: if app.get(field) or field == 'Builds': - # .txt calls it 'builds' internally, everywhere else its 'Builds' + # .txt called it 'builds' internally, everywhere else its 'Builds' if field == 'Builds': if app.get('builds'): cm.update({field: _builds_to_yaml(app)}) @@ -1285,352 +1214,6 @@ build_line_sep = re.compile(r'(?