From ab05f93aec601bfc5716b25839adfbbbe925af6b Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 19:56:58 -0700
Subject: [PATCH] feat: add a gen-appdata command to setup .py regenerates
novelwriter.appdata.xml using git tags to list versions and pulling the
latest version from the source
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
setup.py | 47 +++++
setup/data/novelwriter.appdata.xml | 184 +++++++++++++++----
setup/linux/novelwriter.appdata.xml.template | 59 ++++++
3 files changed, 256 insertions(+), 34 deletions(-)
create mode 100644 setup/linux/novelwriter.appdata.xml.template
diff --git a/setup.py b/setup.py
index bc5529134..638912c7d 100755
--- a/setup.py
+++ b/setup.py
@@ -406,6 +406,7 @@ def genMacOSPlist():
"""
numVers, _, _ = extractVersion()
pkgVers = compactVersion(numVers)
+
outDir = "setup/macos"
copyrightYear = datetime.datetime.now().year
@@ -427,6 +428,48 @@ def genMacOSPlist():
return
+def generateAppdateXML():
+ """update the appdata.xml used by appimage and flatpak.
+ """
+ numVers, _, relDate = extractVersion()
+ pkgVers = compactVersion(numVers)
+
+ outDir = "setup/data"
+
+ curDate = f"date=\"{relDate}\""
+
+ releaseTemplate = (
+ "\n"
+ " https://github.com/vkbo/novelWriter/releases/tag/v{version}\n"
+ ""
+ )
+
+ tagsOutput = subprocess.check_output(["git", "--no-pager", "tag", "-l", "v*.*.*"])
+
+ strVersions = tagsOutput.decode("utf-8").split("\n")
+
+ versions = [v.lstrip("v") for v in reversed(strVersions) if v]
+
+ xmlVersions = [releaseTemplate.format(version=v, date="") for v in versions if v != pkgVers]
+ xmlVersions.insert(0, releaseTemplate.format(version=pkgVers, date=curDate))
+
+ from textwrap import indent
+
+ versionsXMLBlock = indent("\n".join(xmlVersions) + "\n", " " * 2).lstrip()
+
+ desc = indent(readFile("setup/description_short.txt"), " " * 2).lstrip()
+
+ xmlAppData = readFile("setup/linux/novelwriter.appdata.xml.template").format(
+ releases=versionsXMLBlock,
+ description=desc
+ )
+
+ print(f"Writing novelwriter.appdata.xml to {outDir}/novelwriter.appdata.xml")
+ writeFile(f"{outDir}/novelwriter.appdata.xml", xmlAppData)
+
+ return
+
+
##
# Sample Project ZIP File Builder (sample)
##
@@ -2040,6 +2083,10 @@ def winUninstall():
if "gen-plist" in sys.argv:
sys.argv.remove("gen-plist")
genMacOSPlist()
+
+ if "gen-appdata" in sys.argv:
+ sys.argv.remove("gen-appdata")
+ generateAppdateXML()
# Python Packaging
# ================
diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml
index 054b70166..3826e7f6f 100644
--- a/setup/data/novelwriter.appdata.xml
+++ b/setup/data/novelwriter.appdata.xml
@@ -4,15 +4,28 @@
io.novelwriter.novelWriter
CC0-1.0
GPL-3.0
+ Veronica Berglyd Olsen
novelWriter
+ https://novelwriter.io/
+ https://novelwriter.readthedocs.io/en/stable/
+ https://github.com/vkbo/novelWriter/issues
+ https://github.com/vkbo/novelWriter/discussions
+ https://github.com/vkbo/novelWriter
+ https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md
+
+ application/x-novelwriter-project
+
A markdown-like text editor for planning and writing novels.
- novelWriter is a plain text editor designed for writing novels assembled from
+
+ novelWriter is a plain text editor designed for writing novels assembled from
many smaller text documents. It uses a minimal formatting syntax inspired by
Markdown, and adds a meta data syntax for comments, synopsis, and
cross-referencing. It's designed to be a simple text editor that allows for
easy organisation of text and notes, using human readable text files as
- storage for robustness.
+ storage for robustness.
+
+
novelwriter.desktop
https://novelwriter.io/
@@ -47,77 +60,180 @@
-
+
https://github.com/vkbo/novelWriter/releases/tag/v2.0.5
-
+
https://github.com/vkbo/novelWriter/releases/tag/v2.0.4
-
+
https://github.com/vkbo/novelWriter/releases/tag/v2.0.3
-
+
https://github.com/vkbo/novelWriter/releases/tag/v2.0.2
-
+
https://github.com/vkbo/novelWriter/releases/tag/v2.0.1
-
- https://github.com/vkbo/novelWriter/releases/tag/v2.0
-
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.6.6
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.6.5
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.6.4
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.6.3
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.6.2
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.6.1
-
- https://github.com/vkbo/novelWriter/releases/tag/v1.6
-
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.5.5
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.5.4
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.5.3
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.5.2
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.5.1
-
- https://github.com/vkbo/novelWriter/releases/tag/v1.5
-
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.4.2
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.4.1
-
- https://github.com/vkbo/novelWriter/releases/tag/v1.4
-
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.3.3
-
+
https://github.com/vkbo/novelWriter/releases/tag/v1.3.2
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.3.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.2.3
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.2.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.2.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.1.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.0.4
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.0.3
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.0.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v1.0.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.9.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.9.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.7.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.6.3
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.6.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.6.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.5.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.5.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.4.5
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.4.4
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.4.3
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.4.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.4.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.3.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.3.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.2.3
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.2.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.2.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.2.0
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.12.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.11.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.10.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.10.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.1.5
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.1.4
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.1.3
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.1.2
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.1.1
+
+
+ https://github.com/vkbo/novelWriter/releases/tag/v0.1.0
+
+
\ No newline at end of file
diff --git a/setup/linux/novelwriter.appdata.xml.template b/setup/linux/novelwriter.appdata.xml.template
new file mode 100644
index 000000000..3a0a157b6
--- /dev/null
+++ b/setup/linux/novelwriter.appdata.xml.template
@@ -0,0 +1,59 @@
+
+
+
+ io.novelwriter.novelWriter
+ CC0-1.0
+ GPL-3.0
+ Veronica Berglyd Olsen
+ novelWriter
+ https://novelwriter.io/
+ https://novelwriter.readthedocs.io/en/stable/
+ https://github.com/vkbo/novelWriter/issues
+ https://github.com/vkbo/novelWriter/discussions
+ https://github.com/vkbo/novelWriter
+ https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md
+
+ application/x-novelwriter-project
+
+ A markdown-like text editor for planning and writing novels.
+
+
+ {description}
+
+
+ novelwriter.desktop
+ https://novelwriter.io/
+
+
+ https://novelwriter.io/images/screenshot-multi.png
+
+
+ https://novelwriter.io/images/f-nw-build-light.png
+
+
+ https://novelwriter.io/images/f-nw-editor-dark.png
+
+
+ https://novelwriter.io/images/f-nw-editor-light.png
+
+
+ https://novelwriter.io/images/f-nw-novelview-dark.png
+
+
+ https://novelwriter.io/images/f-nw-novelview-light.png
+
+
+ https://novelwriter.io/images/f-nw-outline-dark.png
+
+
+ https://novelwriter.io/images/f-nw-outline-light.png
+
+
+
+ novelwriter.desktop
+
+
+
+ {releases}
+
+
\ No newline at end of file