Skip to content

Commit

Permalink
feat: add a gen-appdata command to setup .py
Browse files Browse the repository at this point in the history
regenerates novelwriter.appdata.xml using git tags to list versions and pulling the latest version from the source

Signed-off-by: Rachel Powers <[email protected]>
  • Loading branch information
Ryex committed Feb 13, 2023
1 parent 14ca0de commit ab05f93
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 34 deletions.
47 changes: 47 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ def genMacOSPlist():
"""
numVers, _, _ = extractVersion()
pkgVers = compactVersion(numVers)

outDir = "setup/macos"

copyrightYear = datetime.datetime.now().year
Expand All @@ -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 = (
"<release version=\"{version}\" {date}>\n"
" <url>https://github.com/vkbo/novelWriter/releases/tag/v{version}</url>\n"
"</release>"
)

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)
##
Expand Down Expand Up @@ -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
# ================
Expand Down
184 changes: 150 additions & 34 deletions setup/data/novelwriter.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@
<id>io.novelwriter.novelWriter</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<developer_name>Veronica Berglyd Olsen<developer_name/>
<name>novelWriter</name>
<url type="homepage">https://novelwriter.io/</url>
<url type="help">https://novelwriter.readthedocs.io/en/stable/</url>
<url type="bugtracker">https://github.com/vkbo/novelWriter/issues</url>
<url type="contact">https://github.com/vkbo/novelWriter/discussions</url>
<url type="vcs-browser">https://github.com/vkbo/novelWriter</url>
<url type="contribute">https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md</url>
<provides>
<mediatype>application/x-novelwriter-project</mediatype>
</provides>
<summary>A markdown-like text editor for planning and writing novels.</summary>
<description>
<p>novelWriter is a plain text editor designed for writing novels assembled from
<p>
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.</p>
storage for robustness.

</p>
</description>
<launchable type="desktop-id">novelwriter.desktop</launchable>
<url type="homepage">https://novelwriter.io/</url>
Expand Down Expand Up @@ -47,77 +60,180 @@
</provides>
<content_rating type="oars-1.0" />
<releases>
<release version="v2.0.5" date="2023-1-8">
<release version="2.0.5" date="2023-02-12">
<url>https://github.com/vkbo/novelWriter/releases/tag/v2.0.5</url>
</release>
<release version="v2.0.4" date="2023-1-8">
<release version="2.0.4" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v2.0.4</url>
</release>
<release version="v2.0.3" date="2023-1-8">
<release version="2.0.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v2.0.3</url>
</release>
<release version="v2.0.2" date="2022-12-1">
<release version="2.0.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v2.0.2</url>
</release>
<release version="v2.0.1" date="2022-11-29">
<release version="2.0.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v2.0.1</url>
</release>
<release version="v2.0" date="2022-11-28">
<url>https://github.com/vkbo/novelWriter/releases/tag/v2.0</url>
</release>
<release version="v1.6.6" date="2022-10-25">
<release version="1.6.6" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6.6</url>
</release>
<release version="v1.6.5" date="2022-10-13">
<release version="1.6.5" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6.5</url>
</release>
<release version="v1.6.4" date="2022-09-29">
<release version="1.6.4" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6.4</url>
</release>
<release version="v1.6.3" date="2022-08-18">
<release version="1.6.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6.3</url>
</release>
<release version="v1.6.2" date="2022-03-20">
<release version="1.6.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6.2</url>
</release>
<release version="v1.6.1" date="2022-03-16">
<release version="1.6.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6.1</url>
</release>
<release version="v1.6" date="2022-02-20">
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.6</url>
</release>
<release version="v1.5.5" date="2022-01-05">
<release version="1.5.5" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.5.5</url>
</release>
<release version="v1.5.4" date="2022-01-04">
<release version="1.5.4" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.5.4</url>
</release>
<release version="v1.5.3" date="2021-12-31">
<release version="1.5.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.5.3</url>
</release>
<release version="v1.5.2" date="2021-12-12">
<release version="1.5.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.5.2</url>
</release>
<release version="v1.5.1" date="2021-10-23">
<release version="1.5.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.5.1</url>
</release>
<release version="v1.5" date="2021-09-19">
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.5</url>
</release>
<release version="v1.4.2" date="2021-08-30">
<release version="1.4.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.4.2</url>
</release>
<release version="v1.4.1" date="2021-07-27">
<release version="1.4.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.4.1</url>
</release>
<release version="v1.4" date="2021-07-27">
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.4</url>
</release>
<release version="v1.3.3" date="2021-06-13">
<release version="1.3.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.3.3</url>
</release>
<release version="v1.3.2" date="2021-05-30">
<release version="1.3.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.3.2</url>
</release>
<release version="1.3.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.3.1</url>
</release>
<release version="1.2.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.2.3</url>
</release>
<release version="1.2.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.2.2</url>
</release>
<release version="1.2.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.2.1</url>
</release>
<release version="1.1.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.1.1</url>
</release>
<release version="1.0.4" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.0.4</url>
</release>
<release version="1.0.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.0.3</url>
</release>
<release version="1.0.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.0.2</url>
</release>
<release version="1.0.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v1.0.1</url>
</release>
<release version="0.9.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.9.2</url>
</release>
<release version="0.9.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.9.1</url>
</release>
<release version="0.7.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.7.1</url>
</release>
<release version="0.6.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.6.3</url>
</release>
<release version="0.6.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.6.2</url>
</release>
<release version="0.6.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.6.1</url>
</release>
<release version="0.5.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.5.2</url>
</release>
<release version="0.5.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.5.1</url>
</release>
<release version="0.4.5" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.4.5</url>
</release>
<release version="0.4.4" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.4.4</url>
</release>
<release version="0.4.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.4.3</url>
</release>
<release version="0.4.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.4.2</url>
</release>
<release version="0.4.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.4.1</url>
</release>
<release version="0.3.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.3.2</url>
</release>
<release version="0.3.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.3.1</url>
</release>
<release version="0.2.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.2.3</url>
</release>
<release version="0.2.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.2.2</url>
</release>
<release version="0.2.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.2.1</url>
</release>
<release version="0.2.0" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.2.0</url>
</release>
<release version="0.12.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.12.1</url>
</release>
<release version="0.11.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.11.1</url>
</release>
<release version="0.10.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.10.2</url>
</release>
<release version="0.10.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.10.1</url>
</release>
<release version="0.1.5" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.1.5</url>
</release>
<release version="0.1.4" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.1.4</url>
</release>
<release version="0.1.3" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.1.3</url>
</release>
<release version="0.1.2" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.1.2</url>
</release>
<release version="0.1.1" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.1.1</url>
</release>
<release version="0.1.0" >
<url>https://github.com/vkbo/novelWriter/releases/tag/v0.1.0</url>
</release>

</releases>
</component>
59 changes: 59 additions & 0 deletions setup/linux/novelwriter.appdata.xml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2018–2022, Veronica Berglyd Olsen <[email protected]> -->
<component type="desktop-application">
<id>io.novelwriter.novelWriter</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<developer_name>Veronica Berglyd Olsen<developer_name/>
<name>novelWriter</name>
<url type="homepage">https://novelwriter.io/</url>
<url type="help">https://novelwriter.readthedocs.io/en/stable/</url>
<url type="bugtracker">https://github.com/vkbo/novelWriter/issues</url>
<url type="contact">https://github.com/vkbo/novelWriter/discussions</url>
<url type="vcs-browser">https://github.com/vkbo/novelWriter</url>
<url type="contribute">https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md</url>
<provides>
<mediatype>application/x-novelwriter-project</mediatype>
</provides>
<summary>A markdown-like text editor for planning and writing novels.</summary>
<description>
<p>
{description}
</p>
</description>
<launchable type="desktop-id">novelwriter.desktop</launchable>
<url type="homepage">https://novelwriter.io/</url>
<screenshots>
<screenshot type="default">
<image>https://novelwriter.io/images/screenshot-multi.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-build-light.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-editor-dark.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-editor-light.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-novelview-dark.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-novelview-light.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-outline-dark.png</image>
</screenshot>
<screenshot>
<image>https://novelwriter.io/images/f-nw-outline-light.png</image>
</screenshot>
</screenshots>
<provides>
<id>novelwriter.desktop</id>
</provides>
<content_rating type="oars-1.0" />
<releases>
{releases}
</releases>
</component>

0 comments on commit ab05f93

Please sign in to comment.