[gnome-software/mwleeds/pwa-plugin] WIP: Add pwa-metainfo-generator
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/mwleeds/pwa-plugin] WIP: Add pwa-metainfo-generator
- Date: Thu, 23 Dec 2021 19:42:13 +0000 (UTC)
commit 9de707feaa53539393c2f4bc3dfa11d0b509a1d6
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Wed Dec 22 17:18:23 2021 -0800
WIP: Add pwa-metainfo-generator
.../gnome-software-foss-pwa-list.csv | 9 ++++
.../gnome-software-foss-pwa-list.xml | 48 +++++++++++++++++
pwa-metainfo-generator/pwa-metainfo-generator.py | 60 ++++++++++++++++++++++
3 files changed, 117 insertions(+)
---
diff --git a/pwa-metainfo-generator/gnome-software-foss-pwa-list.csv
b/pwa-metainfo-generator/gnome-software-foss-pwa-list.csv
new file mode 100644
index 000000000..2370e0476
--- /dev/null
+++ b/pwa-metainfo-generator/gnome-software-foss-pwa-list.csv
@@ -0,0 +1,9 @@
+https://app.diagrams.net/,Apache-2.0
+https://pinafore.social/,AGPL-3.0-only
+https://devdocs.io/,MPL-2.0
+https://snapdrop.net/,GPL-3.0-only
+https://stackedit.io/app,Apache-2.0
+https://squoosh.app/,Apache-2.0
+https://excalidraw.com/,MIT
+https://crypt.ee/,MIT
+https://web.5217.app/,GPL-2.0-only
diff --git a/pwa-metainfo-generator/gnome-software-foss-pwa-list.xml
b/pwa-metainfo-generator/gnome-software-foss-pwa-list.xml
new file mode 100644
index 000000000..5adacea05
--- /dev/null
+++ b/pwa-metainfo-generator/gnome-software-foss-pwa-list.xml
@@ -0,0 +1,48 @@
+<?xml version='1.0' encoding='utf-8'?>
+<components version="0.15">
+ <component type="webapp">
+ <launchable type="url">https://app.diagrams.net/</launchable>
+ <project_license>Apache-2.0</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://pinafore.social/</launchable>
+ <project_license>AGPL-3.0-only</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://devdocs.io/</launchable>
+ <project_license>MPL-2.0</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://snapdrop.net/</launchable>
+ <project_license>GPL-3.0-only</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://stackedit.io/app</launchable>
+ <project_license>Apache-2.0</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://squoosh.app/</launchable>
+ <project_license>Apache-2.0</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://excalidraw.com/</launchable>
+ <project_license>MIT</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://crypt.ee/</launchable>
+ <project_license>MIT</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+ <component type="webapp">
+ <launchable type="url">https://web.5217.app/</launchable>
+ <project_license>GPL-2.0-only</project_license>
+ <metadata_license>FSFAP</metadata_license>
+ </component>
+</components>
\ No newline at end of file
diff --git a/pwa-metainfo-generator/pwa-metainfo-generator.py
b/pwa-metainfo-generator/pwa-metainfo-generator.py
new file mode 100755
index 000000000..7f66d9fc4
--- /dev/null
+++ b/pwa-metainfo-generator/pwa-metainfo-generator.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# Copyright 2021 Matthew Leeds
+# SPDX-License-Identifier: GPL-2.0+
+
+"""
+Generates AppStream metainfo for a set of Progressive Web Apps
+
+Usage: pwa-metainfo-generator.py LIST.CSV
+
+The CSV format expected looks like this:
+
+https://app.diagrams.net/,Apache-2.0
+https://pinafore.social/,AGPL-3.0-only
+...
+
+The output will be written to a file with the same name as the input but a .xml
+file ending.
+
+This tool uses the web app's manifest to fill out the AppStream info, so an
+Internet connection is required
+"""
+
+import csv
+import sys
+import xml.etree.ElementTree as ET
+
+
+def main():
+ if len(sys.argv) != 2 or not sys.argv[1].endswith('.csv'):
+ print('Usage: {} input.csv'.format(sys.argv[0]))
+ sys.exit(1)
+
+ input_filename = sys.argv[1]
+ out_filename = input_filename.replace('.csv', '.xml')
+ with open(input_filename) as input_csv:
+ components = ET.Element('components')
+ components.set('version', '0.15')
+ reader = csv.reader(input_csv)
+ for app in reader:
+ app_component = ET.SubElement(components, 'component')
+ app_component.set('type', 'webapp')
+
+ launchable = ET.SubElement(app_component, 'launchable')
+ launchable.set('type', 'url')
+ launchable.text = app[0]
+
+ project_license = ET.SubElement(app_component, 'project_license')
+ project_license.text = app[1]
+ metadata_license = ET.SubElement(app_component, 'metadata_license')
+ # metadata license is a required field but we don't have one, assume FSFAP?
+ metadata_license.text = 'FSFAP'
+
+ tree = ET.ElementTree(components)
+ ET.indent(tree)
+ tree.write(out_filename, xml_declaration=True, encoding='utf-8', method='xml')
+
+
+if __name__=='__main__':
+ main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]