From 427abafe4339234bdc4c16767b3bb028cdfe1090 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Wed, 30 Nov 2022 11:17:14 -0700 Subject: [PATCH 01/14] feat: add flatpak manifest Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- flatpak/generate-pypi-deps-json.sh | 11 +++ flatpak/io.novelwriter.novelWriter.yml | 56 +++++++++++++ flatpak/pypi-deps.json | 35 ++++++++ setup.py | 4 +- setup/data/novelwriter.appdata.xml | 111 +++++++++++++++++++++++++ setup/novelwriter.appdata.xml | 21 ----- 6 files changed, 215 insertions(+), 23 deletions(-) create mode 100755 flatpak/generate-pypi-deps-json.sh create mode 100644 flatpak/io.novelwriter.novelWriter.yml create mode 100644 flatpak/pypi-deps.json create mode 100644 setup/data/novelwriter.appdata.xml delete mode 100644 setup/novelwriter.appdata.xml diff --git a/flatpak/generate-pypi-deps-json.sh b/flatpak/generate-pypi-deps-json.sh new file mode 100755 index 000000000..9f6c85c5e --- /dev/null +++ b/flatpak/generate-pypi-deps-json.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +cp ../requirements.txt . +sed -e '/pyqt5/s/^/#/g' -i requirements.txt +curl -LO https://github.com/flatpak/flatpak-builder-tools/raw/master/pip/flatpak-pip-generator +python3 flatpak-pip-generator \ + --requirements-file=requirements.txt \ + --runtime=com.riverbankcomputing.PyQt.BaseApp//5.15-22.08 \ + -o pypi-deps +rm requirements.txt +rm flatpak-pip-generator \ No newline at end of file diff --git a/flatpak/io.novelwriter.novelWriter.yml b/flatpak/io.novelwriter.novelWriter.yml new file mode 100644 index 000000000..274f2529d --- /dev/null +++ b/flatpak/io.novelwriter.novelWriter.yml @@ -0,0 +1,56 @@ +app-id: io.novelwriter.novelWriter +runtime: org.kde.Platform +runtime-version: '5.15-22.08' +sdk: org.kde.Sdk +base: com.riverbankcomputing.PyQt.BaseApp +base-version: '5.15-22.08' +cleanup-commands: + - /app/cleanup-BaseApp.sh +command: novelwriter +build-options: + env: + - BASEAPP_REMOVE_WEBENGINE=1 +finish-args: + # X11 + XShm access + - --share=ipc + - --socket=x11 + # Wayland access + - --socket=wayland + # Needs to talk to the network: + - --share=network + # Needs to save files locally + #- --filesystem=xdg-documents + #- --filesystem=home + - --filesystem=host + # OpenGL rendering + - --device=dri +modules: + - pypi-deps.json + - name: enchant + buildsystem: autotools + sources: + - type: archive + url: https://github.com/AbiWord/enchant/releases/download/v2.3.3/enchant-2.3.3.tar.gz + sha256: 3da12103f11cf49c3cf2fd2ce3017575c5321a489e5b9bfa81dd91ec413f3891 + - name: novelWriter + buildsystem: simple + build-commands: + - python3 setup.py install --prefix=${FLATPAK_DEST} --root=/ + - install -Dm644 setup/data/novelwriter.desktop -T ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop + - sed -i 's/Icon=novelwriter/Icon=io.novelwriter.novelWriter/' ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop + - for size in 16x16 24x24 32x32 48x48 64x64 128x128 256x256; do + install -Dm644 -T setup/data/hicolor/$size/apps/novelwriter.png ${FLATPAK_DEST}/share/icons/hicolor/$size/apps/${FLATPAK_ID}.png; + install -Dm644 -T setup/data/hicolor/$size/mimetypes/application-x-novelwriter-project.png ${FLATPAK_DEST}/share/icons/hicolor/$size/mimetypes/application-x-novelwriter-project.png; + done + - install -Dm644 -T setup/data/hicolor/scalable/apps/novelwriter.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg; + - install -Dm644 -T setup/data/hicolor/scalable/mimetypes/application-x-novelwriter-project.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/mimetypes/application-x-novelwriter-project.svg; + - install -Dm644 -T setup/data/novelwriter.appdata.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml + - sed -i 's/novelwriter.desktop/io.novelwriter.novelWriter.desktop/' ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml + sources: + - type: dir + path: ../ + # - type: archive + # path: ../dist_minimal/novelwriter-1.7b1-minimal-linux.zip + # sha256: d4ff96280d5c86c2b14d7ed3b9bc3ced0fc401530afd1eeaa5aabc63d10ceba6 + # strip-components: 0 + diff --git a/flatpak/pypi-deps.json b/flatpak/pypi-deps.json new file mode 100644 index 000000000..95661f544 --- /dev/null +++ b/flatpak/pypi-deps.json @@ -0,0 +1,35 @@ +{ + "name": "pypi-deps", + "buildsystem": "simple", + "build-commands": [], + "modules": [ + { + "name": "python3-lxml", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"lxml>=4.2.0\" --no-build-isolation" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/70/bb/7a2c7b4f8f434aa1ee801704bf08f1e53d7b5feba3d5313ab17003477808/lxml-4.9.1.tar.gz", + "sha256": "fe749b052bb7233fe5d072fcb549221a8cb1a16725c47c37e42b0b9cb3ff2c3f" + } + ] + }, + { + "name": "python3-pyenchant", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"pyenchant>=3.0.0\" --no-build-isolation" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/54/4c/a741dddab6ad96f257d90cb4d23067ffadac526c9cab3a99ca6ce3c05477/pyenchant-3.2.2-py3-none-any.whl", + "sha256": "5facc821ece957208a81423af7d6ec7810dad29697cb0d77aae81e4e11c8e5a6" + } + ] + } + ] +} \ No newline at end of file diff --git a/setup.py b/setup.py index 75bcd2b13..3cdfad5d9 100755 --- a/setup.py +++ b/setup.py @@ -588,6 +588,7 @@ def makeMinimalPackage(targetOS): print("") rootFiles = [ + "MANIFEST.in", "README.md", "LICENSE.md", "CREDITS.md", @@ -1069,8 +1070,7 @@ def makeAppImage(sysArgs): # Write Metadata # ============== - appDescription = readFile("setup/description_short.txt") - appdataXML = readFile("setup/novelwriter.appdata.xml").format(description=appDescription) + appdataXML = readFile("setup/data/novelwriter.appdata.xml") writeFile(f"{imageDir}/novelwriter.appdata.xml", appdataXML) print("Wrote: novelwriter.appdata.xml") diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml new file mode 100644 index 000000000..3156bf2ef --- /dev/null +++ b/setup/data/novelwriter.appdata.xml @@ -0,0 +1,111 @@ + + + + io.novelwriter.novelWriter + CC0-1.0 + GPL-3.0 + novelWriter + A markdown-like text editor for planning and writing novels + +

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.

+
+ 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 + + + + + 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 + + +
\ No newline at end of file diff --git a/setup/novelwriter.appdata.xml b/setup/novelwriter.appdata.xml deleted file mode 100644 index 98a6e33bf..000000000 --- a/setup/novelwriter.appdata.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - novelwriter - GPL-3.0 - GPL-3.0 - novelWriter - A markdown-like text editor for planning and writing novels - -

{description}

-
- novelwriter.desktop - https://novelwriter.io/ - - - https://novelwriter.io/images/screenshot-multi.png - - - - novelwriter.desktop - -
\ No newline at end of file From 02f474504ba19a49fe82082a7efd9f26261f86bd Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Wed, 30 Nov 2022 11:43:29 -0700 Subject: [PATCH 02/14] fix: only use one screenshot as defualt Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- setup/data/novelwriter.appdata.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml index 3156bf2ef..1dcbb956a 100644 --- a/setup/data/novelwriter.appdata.xml +++ b/setup/data/novelwriter.appdata.xml @@ -17,28 +17,28 @@ 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 From 20adf39d8b8c2aa67b941a97a6615b3158bfe190 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Wed, 30 Nov 2022 12:18:27 -0700 Subject: [PATCH 03/14] fix: link to flatpak-pip-generator in comment Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- flatpak/generate-pypi-deps-json.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/flatpak/generate-pypi-deps-json.sh b/flatpak/generate-pypi-deps-json.sh index 9f6c85c5e..ce75386d1 100755 --- a/flatpak/generate-pypi-deps-json.sh +++ b/flatpak/generate-pypi-deps-json.sh @@ -1,4 +1,5 @@ #! /bin/sh +# uses https://github.com/flatpak/flatpak-builder-tools/blob/master/pip/flatpak-pip-generator cp ../requirements.txt . sed -e '/pyqt5/s/^/#/g' -i requirements.txt From 3da0510a8d9b91fdf3006a25c5920095733e7a0f Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Wed, 30 Nov 2022 12:21:42 -0700 Subject: [PATCH 04/14] fix: redundant word in metadata add period Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- setup/data/novelwriter.appdata.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml index 1dcbb956a..8ac149677 100644 --- a/setup/data/novelwriter.appdata.xml +++ b/setup/data/novelwriter.appdata.xml @@ -1,11 +1,11 @@ - + io.novelwriter.novelWriter CC0-1.0 GPL-3.0 novelWriter - A markdown-like text editor for planning and writing novels + A markdown-like text editor for planning and writing novels.

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. + +

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 From b82bead4863e9693a7d8cf1f68cac774d6e2a774 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:32:07 -0700 Subject: [PATCH 14/14] fix: properly sort versions in appdate.xml Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- setup.py | 5 ++-- setup/data/novelwriter.appdata.xml | 30 +++++++++----------- setup/linux/novelwriter.appdata.xml.template | 6 ++-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/setup.py b/setup.py index beb22e25b..fd8b6d283 100755 --- a/setup.py +++ b/setup.py @@ -448,9 +448,10 @@ def generateAppdateXML(): strVersions = tagsOutput.decode("utf-8").split("\n") - versions = [v.lstrip("v") for v in reversed(strVersions) if v] + versions = [tuple(map(int, v.lstrip("v").split("."))) for v in strVersions if v] + sortedVersions = [".".join(map(str, v)) for v in reversed(sorted(versions))] - xmlVersions = [releaseTemplate.format(version=v, date="") for v in versions if v != pkgVers] + xmlVersions = [releaseTemplate.format(version=v, date="") for v in sortedVersions if v != pkgVers] xmlVersions.insert(0, releaseTemplate.format(version=pkgVers, date=curDate)) from textwrap import indent diff --git a/setup/data/novelwriter.appdata.xml b/setup/data/novelwriter.appdata.xml index 3826e7f6f..9a1bafb59 100644 --- a/setup/data/novelwriter.appdata.xml +++ b/setup/data/novelwriter.appdata.xml @@ -4,7 +4,7 @@ io.novelwriter.novelWriter CC0-1.0 GPL-3.0 - Veronica Berglyd Olsen + Veronica Berglyd Olsen novelWriter https://novelwriter.io/ https://novelwriter.readthedocs.io/en/stable/ @@ -14,6 +14,7 @@ https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md application/x-novelwriter-project + novelwriter.desktop A markdown-like text editor for planning and writing novels. @@ -55,9 +56,6 @@ https://novelwriter.io/images/f-nw-outline-light.png - - novelwriter.desktop - @@ -147,6 +145,18 @@ https://github.com/vkbo/novelWriter/releases/tag/v1.0.1 + + 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.9.2 @@ -204,18 +214,6 @@ 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 diff --git a/setup/linux/novelwriter.appdata.xml.template b/setup/linux/novelwriter.appdata.xml.template index 3a0a157b6..70a411668 100644 --- a/setup/linux/novelwriter.appdata.xml.template +++ b/setup/linux/novelwriter.appdata.xml.template @@ -4,7 +4,7 @@ io.novelwriter.novelWriter CC0-1.0 GPL-3.0 - Veronica Berglyd Olsen + Veronica Berglyd Olsen novelWriter https://novelwriter.io/ https://novelwriter.readthedocs.io/en/stable/ @@ -14,6 +14,7 @@ https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md application/x-novelwriter-project + novelwriter.desktop A markdown-like text editor for planning and writing novels. @@ -49,9 +50,6 @@ https://novelwriter.io/images/f-nw-outline-light.png - - novelwriter.desktop - {releases}