diff flatpak/build_manifest.py @ 145:9201caf7b2a8

flatpak (build_manifest): don't crash if icon is not specified
author Goffi <goffi@goffi.org>
date Mon, 24 Jun 2019 08:57:12 +0200
parents e23e414987d7
children 64c02902b86a
line wrap: on
line diff
--- a/flatpak/build_manifest.py	Mon Jun 24 08:40:00 2019 +0200
+++ b/flatpak/build_manifest.py	Mon Jun 24 08:57:12 2019 +0200
@@ -792,7 +792,9 @@
 
 def get_icon():
     icon = build_settings.get('icon')
-    if icon is not None:
+    if icon is None:
+        return []
+    else:
         if isinstance(icon, str):
             icon = {'url': icon}
         icon_path = Path(urlparse(icon['url']).path)
@@ -807,13 +809,15 @@
 
         dest_path = f"/app/share/icons/hicolor/{icon['size']}/apps/{app_id}.{suffix}"
 
-        return file_from_url(
+        data = file_from_url(
             url = icon['url'],
             dest = dest_path,
             # we have common cache if several manifest use the same icon URL
             step_name = f"icon__{icon}",
             step_message = "retrieving application icon",
         )
+        data[0]['name'] = 'icon'
+        return data
 
 
 def generate_appdata_from_template(template_file):