chiark / gitweb /
Add Liberapay support
[fdroidserver.git] / fdroidserver / metadata.py
index c29c1e4c29a079e545f60d678df0d5c11b7c6c5f..3c03df728ff60cc17bfd99f8b641903aafc0806c 100644 (file)
@@ -70,6 +70,7 @@ app_fields = set([
     'Changelog',
     'Donate',
     'FlattrID',
+    'LiberapayID',
     'Bitcoin',
     'Litecoin',
     'Name',
@@ -120,6 +121,7 @@ class App(dict):
         self.Changelog = ''
         self.Donate = None
         self.FlattrID = None
+        self.LiberapayID = None
         self.Bitcoin = None
         self.Litecoin = None
         self.Name = None
@@ -391,6 +393,10 @@ valuetypes = {
                    r'^[0-9a-z]+$',
                    ['FlattrID']),
 
+    FieldValidator("Liberapay ID",
+                   r'^[0-9]+$',
+                   ['LiberapayID']),
+
     FieldValidator("HTTP link",
                    r'^http[s]?://',
                    ["WebSite", "SourceCode", "IssueTracker", "Changelog", "Donate"]),
@@ -748,6 +754,8 @@ def read_metadata(xref=True, check_vcs=[], 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 or .fdroid.json.'))
         packageName, _ignored = fdroidserver.common.get_extension(os.path.basename(metadatapath))
         if packageName in apps:
             warn_or_exception(_("Found multiple metadata files for {appid}")
@@ -1136,6 +1144,7 @@ def write_yaml(mf, app):
         'Changelog',
         'Donate',
         'FlattrID',
+        'LiberapayID',
         'Bitcoin',
         'Litecoin',
         '\n',
@@ -1427,6 +1436,7 @@ def write_plaintext_metadata(mf, app, w_comment, w_field, w_build):
     w_field_nonempty('Changelog')
     w_field_nonempty('Donate')
     w_field_nonempty('FlattrID')
+    w_field_nonempty('LiberapayID')
     w_field_nonempty('Bitcoin')
     w_field_nonempty('Litecoin')
     mf.write('\n')
@@ -1545,5 +1555,5 @@ def write_metadata(metadatapath, app):
 
 def add_metadata_arguments(parser):
     '''add common command line flags related to metadata processing'''
-    parser.add_argument("-W", default='error',
-                        help=_("force errors to be warnings, or ignore"))
+    parser.add_argument("-W", choices=['error', 'warn', 'ignore'], default='error',
+                        help=_("force metadata errors (default) to be warnings, or to be ignored."))