novelWriter is a plain text editor designed for writing novels assembled from
many smaller text documents. It uses a minimal formatting syntax inspired by
From a9314cc6d5a4468cdbf6c2a5d5a74322d70628a5 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 8 Jan 2023 21:28:06 -0700
Subject: [PATCH 05/14] refactor: moce flatpak into setup folder
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
{flatpak => setup/flatpak}/generate-pypi-deps-json.sh | 0
{flatpak => setup/flatpak}/io.novelwriter.novelWriter.yml | 0
{flatpak => setup/flatpak}/pypi-deps.json | 0
3 files changed, 0 insertions(+), 0 deletions(-)
rename {flatpak => setup/flatpak}/generate-pypi-deps-json.sh (100%)
rename {flatpak => setup/flatpak}/io.novelwriter.novelWriter.yml (100%)
rename {flatpak => setup/flatpak}/pypi-deps.json (100%)
diff --git a/flatpak/generate-pypi-deps-json.sh b/setup/flatpak/generate-pypi-deps-json.sh
similarity index 100%
rename from flatpak/generate-pypi-deps-json.sh
rename to setup/flatpak/generate-pypi-deps-json.sh
diff --git a/flatpak/io.novelwriter.novelWriter.yml b/setup/flatpak/io.novelwriter.novelWriter.yml
similarity index 100%
rename from flatpak/io.novelwriter.novelWriter.yml
rename to setup/flatpak/io.novelwriter.novelWriter.yml
diff --git a/flatpak/pypi-deps.json b/setup/flatpak/pypi-deps.json
similarity index 100%
rename from flatpak/pypi-deps.json
rename to setup/flatpak/pypi-deps.json
From ea7c72a5096983381f5a9f2c205b18ed397b3432 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Mon, 9 Jan 2023 02:35:05 -0700
Subject: [PATCH 06/14] feat(flatpak): add a build-flatpak setup command
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
setup.py | 83 ++++++++++++++++++++
setup/data/novelwriter.appdata.xml | 6 ++
setup/flatpak/io.novelwriter.novelWriter.yml | 4 +-
3 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 3cdfad5d9..ba5c0959e 100755
--- a/setup.py
+++ b/setup.py
@@ -1123,6 +1123,79 @@ def makeAppImage(sysArgs):
return unparsedArgs
+
+##
+# Make a flatpak
+##
+
+def makeFlatpak():
+ """build and install a flatpak localy (not for flathub)
+ """
+
+
+ print("")
+ print("Build flatpak")
+ print("==============")
+ print("")
+
+ numVers, _, relDate = extractVersion()
+ pkgVers = compactVersion(numVers)
+ relDate = datetime.datetime.strptime(relDate, "%Y-%m-%d")
+
+ bldDir = "dist_flatpak"
+ bldPkg = f"novelwriter_{pkgVers}"
+ outDir = f"{bldDir}/{bldPkg}"
+
+
+ # Set Up Folders
+ # ==============
+
+ if not os.path.isdir(bldDir):
+ os.mkdir(bldDir)
+
+ if os.path.isdir(outDir):
+ print("Removing old build files ...")
+ print("")
+ shutil.rmtree(outDir)
+
+ os.mkdir(outDir)
+
+ # Build Additional Assets
+ # =======================
+
+ buildQtI18n()
+ buildSampleZip()
+ buildPdfManual()
+
+ # Build flatpak
+ # ==============
+
+ manifestPath = "setup/flatpak/io.novelwriter.novelWriter.yml"
+
+ bundlFile = f"{bldDir}/novelWriter-{pkgVers}-linux.flatpak"
+
+ try:
+ subprocess.call([
+ "flatpak-builder", f"--repo={outDir}/repo", "--install-deps-from=flathub", "--force-clean", outDir, manifestPath
+ ])
+ subprocess.call([
+ "flatpak", "build-bundle", f"{outDir}/repo", bundlFile, "io.novelwriter.novelWriter",
+ ])
+ except Exception as exc:
+ print("Flatpak build: FAILED")
+ print("")
+ print(str(exc))
+ print("")
+ print("Dependencies:")
+ print(" * flatpak flatpak-builder")
+ print("")
+ sys.exit(1)
+
+ shaFile = makeCheckSum(os.path.basename(bundlFile), cwd=bldDir)
+
+ toUpload(bundlFile)
+ toUpload(shaFile)
+
##
# Make Windows Setup EXE (build-win-exe)
##
@@ -1879,6 +1952,8 @@ def winUninstall():
" The package must be built from a minimal windows zip file.",
" build-appimage Build an AppImage. Argument --linux-tag defaults to",
" manylinux1_x86_64 / i386, and --python-version to 3.10.",
+ " build-flatpak Build a flatpak bundle. Builds a local flatpak for install,",
+ " not for distribution to flathub.",
"",
"System Install:",
"",
@@ -1988,6 +2063,14 @@ def winUninstall():
else:
print("ERROR: Command 'build-appimage' can only be used on Linux")
sys.exit(1)
+
+ if "build-flatpak" in sys.argv:
+ sys.argv.remove("build-flatpak")
+ if hostOS == OS_LINUX:
+ makeFlatpak()
+ else:
+ print("ERROR: Command 'install-flatpak' can only be used on Linux")
+ sys.exit(1)
# General Installers
# ==================
diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml
index 8ac149677..cb5a489f9 100644
--- a/setup/data/novelwriter.appdata.xml
+++ b/setup/data/novelwriter.appdata.xml
@@ -47,6 +47,12 @@
+
+ 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
diff --git a/setup/flatpak/io.novelwriter.novelWriter.yml b/setup/flatpak/io.novelwriter.novelWriter.yml
index 274f2529d..66a0cd677 100644
--- a/setup/flatpak/io.novelwriter.novelWriter.yml
+++ b/setup/flatpak/io.novelwriter.novelWriter.yml
@@ -48,9 +48,9 @@ modules:
- sed -i 's/novelwriter.desktop/io.novelwriter.novelWriter.desktop/' ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml
sources:
- type: dir
- path: ../
+ path: ../../
# - type: archive
- # path: ../dist_minimal/novelwriter-1.7b1-minimal-linux.zip
+ # path: ../../dist_minimal/novelwriter-1.7b1-minimal-linux.zip
# sha256: d4ff96280d5c86c2b14d7ed3b9bc3ced0fc401530afd1eeaa5aabc63d10ceba6
# strip-components: 0
From de9ebbf99d81d9ad17cb4cc53b9081d2b505d961 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 17:14:09 -0700
Subject: [PATCH 07/14] feat: add flatpak build to workflow
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++
setup.py | 8 --------
2 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 04b77a26b..cf8156d24 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -77,6 +77,46 @@ jobs:
if-no-files-found: error
retention-days: 1
+ buildFlatpak:
+ needs: buildAssets
+ runs-on: ubuntu-latest
+ steps:
+ - name: Python Setup
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3
+ architecture: x64
+
+ - name: Install Packages (pip)
+ run: pip install python-appimage
+
+ - name: Checkout Source
+ uses: actions/checkout@v3
+
+ - name: Get Version
+ shell: bash
+ run: |
+ NW_VER=$(python setup.py version)
+ echo "novelWriter Version: $NW_VER"
+ echo "VERSION=$NW_VER" >> $GITHUB_ENV
+
+ - name: Download Artifacts
+ uses: actions/download-artifact@v3
+ with:
+ name: nw-assets
+ path: novelwriter/assets
+
+ - name: Build Flatpak
+ run: python setup.py build-flatpak
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: novelWriter-${{ env.VERSION }}-linux.flatpak
+ path: dist_flatpak/novelWriter-${{ env.VERSION }}-linux.flatpak
+ if-no-files-found: error
+ retention-days: 1
+
buildMac:
needs: buildAssets
strategy:
diff --git a/setup.py b/setup.py
index c52787dfd..bc5529134 100755
--- a/setup.py
+++ b/setup.py
@@ -1156,7 +1156,6 @@ def makeFlatpak():
"""build and install a flatpak localy (not for flathub)
"""
-
print("")
print("Build flatpak")
print("==============")
@@ -1184,13 +1183,6 @@ def makeFlatpak():
os.mkdir(outDir)
- # Build Additional Assets
- # =======================
-
- buildQtI18n()
- buildSampleZip()
- buildPdfManual()
-
# Build flatpak
# ==============
From 04f82e51511949327d89f87a6b5b51011cda8210 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 17:37:39 -0700
Subject: [PATCH 08/14] fix: install flatpak-builder in flatpak workflow
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.github/workflows/build.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cf8156d24..0923a43cc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -87,8 +87,10 @@ jobs:
python-version: 3
architecture: x64
- - name: Install Packages (pip)
- run: pip install python-appimage
+ - name: Install Packages (apt)
+ run: |
+ sudo apt update
+ sudo apt install flatpak flatpak-builder
- name: Checkout Source
uses: actions/checkout@v3
From 3303eb30432ddc851233a55e4d5a1f108ddc99ff Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 17:41:30 -0700
Subject: [PATCH 09/14] add new releases to appdata.xml
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
setup/data/novelwriter.appdata.xml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml
index cb5a489f9..054b70166 100644
--- a/setup/data/novelwriter.appdata.xml
+++ b/setup/data/novelwriter.appdata.xml
@@ -47,6 +47,12 @@
+
+ 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
From 77246aad17e26d666660794b6654744a8517d499 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 17:47:16 -0700
Subject: [PATCH 10/14] fix: ensure flathub repo is added during build
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.github/workflows/build.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0923a43cc..655f67f6a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -91,6 +91,7 @@ jobs:
run: |
sudo apt update
sudo apt install flatpak flatpak-builder
+ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Checkout Source
uses: actions/checkout@v3
From 575a046cac581b635018733ebe911d974f0ce24f Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 17:51:05 -0700
Subject: [PATCH 11/14] fix: use sudo for flatpak remote-add
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 655f67f6a..ca04ff804 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -91,7 +91,7 @@ jobs:
run: |
sudo apt update
sudo apt install flatpak flatpak-builder
- flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
+ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Checkout Source
uses: actions/checkout@v3
From 14ca0deb0065080fd44d9bed1a8cd92b9bd9852c Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 12 Feb 2023 18:02:31 -0700
Subject: [PATCH 12/14] fix : use sudo to build flatpak
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ca04ff804..ffb47e491 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -110,7 +110,7 @@ jobs:
path: novelwriter/assets
- name: Build Flatpak
- run: python setup.py build-flatpak
+ run: sudo python setup.py build-flatpak
- name: Upload Artifacts
uses: actions/upload-artifact@v3
From 7233137ad32f577e1930569393016e8765c33410 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 13/14] 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 | 49 ++++-
setup/data/novelwriter.appdata.xml | 184 +++++++++++++++----
setup/linux/novelwriter.appdata.xml.template | 59 ++++++
3 files changed, 257 insertions(+), 35 deletions(-)
create mode 100644 setup/linux/novelwriter.appdata.xml.template
diff --git a/setup.py b/setup.py
index bc5529134..beb22e25b 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)
##
@@ -1153,7 +1196,7 @@ def makeAppImage(sysArgs):
##
def makeFlatpak():
- """build and install a flatpak localy (not for flathub)
+ """build a flatpak bundle localy (not for flathub)
"""
print("")
@@ -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.
+
+