chiark / gitweb /
properly parse build metadata list types like gradle=
authorHans-Christoph Steiner <hans@eds.org>
Mon, 7 Nov 2016 20:21:32 +0000 (21:21 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 16 Nov 2016 22:28:03 +0000 (23:28 +0100)
Something like `gradle: yes` in YAML will be parsed as a boolean, since
'yes' is officially defined as a boolean true in YAML.  For metadata fields
that need to be lists, this needs to be converted.  Same goes for a single
string like `gradle: customFlavor`.

fdroidserver/metadata.py
tests/metadata/net.osmand.plus.pickle
tests/metadata/org.adaway.pickle
tests/metadata/org.videolan.vlc.pickle

index ddfb19b531f7ca73817f87e0165734452aa7d950..0df2ece0469cf5b881cb20a11c3d7b8e3bb4af13 100644 (file)
@@ -904,6 +904,11 @@ def post_metadata_parse(app):
             elif ftype == TYPE_STRING:
                 if isinstance(v, bool) and v:
                     build.__dict__[k] = 'yes'
+            elif ftype == TYPE_LIST:
+                if isinstance(v, bool) and v:
+                    build.__dict__[k] = ['yes']
+                elif isinstance(v, str):
+                    build.__dict__[k] = [v]
 
     if not app.Description:
         app.Description = 'No description available'
index cf9a39ec1f83b3f2393b562f560b1872d1e5ec83..76409710f731bf7434872473ad0d52e27768d5f3 100644 (file)
Binary files a/tests/metadata/net.osmand.plus.pickle and b/tests/metadata/net.osmand.plus.pickle differ
index cc2907ab491dc8d9b5f7e69cca9b1e8f2045aa62..4c35fe2ee8819af817c32dc4a64deb547d4879cf 100644 (file)
Binary files a/tests/metadata/org.adaway.pickle and b/tests/metadata/org.adaway.pickle differ
index a1810e600d7f2c48e0c21a5ba2a8bda56294d535..8a727bb53a5501b6a8636a770a95e0bf0bd5a0db 100644 (file)
Binary files a/tests/metadata/org.videolan.vlc.pickle and b/tests/metadata/org.videolan.vlc.pickle differ