From b1d1af2153ec36b66dc3f33be2f133da5830dc73 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 17:41:10 +0200 Subject: [PATCH 01/15] Add M1 build for MacOS --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++------ setup/macos/build.sh | 24 ++++++++++++++++++------ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 492bb5f4..dc057885 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: - name: Python Setup uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" architecture: x64 - name: Install Packages (apt) @@ -42,13 +42,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.12"] linux-tag: ["manylinux_2_24_x86_64", "manylinux_2_28_x86_64"] steps: - name: Python Setup uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" architecture: x64 - name: Install Packages (pip) @@ -74,7 +74,7 @@ jobs: if-no-files-found: error retention-days: 1 - buildMac: + buildMac-AMD64: needs: buildAssets runs-on: macos-12 steps: @@ -88,12 +88,36 @@ jobs: path: novelwriter/assets - name: Build App Bundle - run: ./setup/macos/build.sh + run: ./setup/macos/build.sh amd64 - name: Upload DMG uses: actions/upload-artifact@v4 with: - name: MacOS-DMG + name: MacOS-AMD64-DMG + path: dist_macos + if-no-files-found: error + retention-days: 1 + + buildMac-M1: + needs: buildAssets + runs-on: macos-14 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: nw-assets + path: novelwriter/assets + + - name: Build App Bundle + run: ./setup/macos/build.sh arm64 + + - name: Upload DMG + uses: actions/upload-artifact@v4 + with: + name: MacOS-M1-DMG path: dist_macos if-no-files-found: error retention-days: 1 diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 9fff747b..1304488a 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -1,5 +1,17 @@ #! /bin/bash +if [ -z "$1"]; then + ARCH="amd64" +else + ARCH="$1" +fi + +if [ $ARCH == "amd64 "]; then + CONDA="x86_64" +else + CONDA="$ARCH" +fi + # Use RAM disk if possible if [ -d /dev/shm ]; then TEMP_BASE=/dev/shm @@ -76,9 +88,9 @@ pushd "$BUILD_DIR"/ || exit 1 # --- Create Miniconda Env ---------------------------------------------------------------------- # echo "Downloading Miniconda ..." -curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/miniconda -f -rm Miniconda3-latest-MacOSX-x86_64.sh +curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-$CONDA.sh +bash Miniconda3-latest-MacOSX-$CONDA.sh -b -p ~/miniconda -f +rm Miniconda3-latest-MacOSX-$CONDA.sh export PATH="$HOME/miniconda/bin:$PATH" echo "Creating Conda env ..." @@ -123,7 +135,7 @@ cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/ # Create entry script echo "Creating entry script ..." -cat > novelWriter.app/Contents/MacOS/novelWriter <<\EOF +cat > novelWriter.app/Contents/MacOS/novelWriter << EOF #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" $DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py $@ @@ -173,8 +185,8 @@ brew install create-dmg create-dmg --volname "novelWriter $VERSION" --volicon $SRC_DIR/setup/macos/novelwriter.icns \ --window-pos 200 120 --window-size 800 400 --icon-size 100 \ --icon novelWriter.app 200 190 --hide-extension novelWriter.app \ - --app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}"-amd64.dmg "$BUILD_DIR"/ + --app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}"-$ARCH.dmg "$BUILD_DIR"/ pushd $RLS_DIR || exit 1 -shasum -a 256 novelWriter-"${VERSION}"-amd64.dmg | tee novelWriter-"${VERSION}"-amd64.dmg.sha256 +shasum -a 256 novelWriter-"${VERSION}"-$ARCH.dmg | tee novelWriter-"${VERSION}"-$ARCH.dmg.sha256 popd || exit 1 From 885974a84ea170f5f67551a513a6b54f606a55e4 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 17:41:36 +0200 Subject: [PATCH 02/15] Keep artifacts for 14 days --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc057885..92718e8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: novelwriter/assets/manual.pdf novelwriter/assets/i18n/*.qm if-no-files-found: error - retention-days: 1 + retention-days: 14 buildLinux: needs: buildAssets @@ -72,7 +72,7 @@ jobs: name: AppImage-${{ matrix.python-version }}-${{ matrix.linux-tag }} path: dist_appimage if-no-files-found: error - retention-days: 1 + retention-days: 14 buildMac-AMD64: needs: buildAssets @@ -96,7 +96,7 @@ jobs: name: MacOS-AMD64-DMG path: dist_macos if-no-files-found: error - retention-days: 1 + retention-days: 14 buildMac-M1: needs: buildAssets @@ -120,4 +120,4 @@ jobs: name: MacOS-M1-DMG path: dist_macos if-no-files-found: error - retention-days: 1 + retention-days: 14 From 621e933f63cc8a14c7edd2f61a901a939f2d4f61 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:02:10 +0200 Subject: [PATCH 03/15] Make some tweaks to build scripts --- .github/workflows/build.yml | 16 ++++++++++++---- setup/macos/build.sh | 16 +++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92718e8a..879cc42f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: - name: Python Setup uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.11" architecture: x64 - name: Install Packages (pip) @@ -76,7 +76,11 @@ jobs: buildMac-AMD64: needs: buildAssets - runs-on: macos-12 + runs-on: macos-13 + env: + PYTHON_VERSION: "3.12" + ARCHITECTURE: amd64 + MINICONDA_ARCH: x86_64 steps: - name: Checkout uses: actions/checkout@v4 @@ -88,7 +92,7 @@ jobs: path: novelwriter/assets - name: Build App Bundle - run: ./setup/macos/build.sh amd64 + run: ./setup/macos/build.sh $PYTHON_VERSION $ARCHITECTURE $MINICONDA_ARCH - name: Upload DMG uses: actions/upload-artifact@v4 @@ -101,6 +105,10 @@ jobs: buildMac-M1: needs: buildAssets runs-on: macos-14 + env: + PYTHON_VERSION: "3.12" + ARCHITECTURE: arm64 + MINICONDA_ARCH: arm64 steps: - name: Checkout uses: actions/checkout@v4 @@ -112,7 +120,7 @@ jobs: path: novelwriter/assets - name: Build App Bundle - run: ./setup/macos/build.sh arm64 + run: ./setup/macos/build.sh $PYTHON_VERSION $ARCHITECTURE $MINICONDA_ARCH - name: Upload DMG uses: actions/upload-artifact@v4 diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 1304488a..8c127fc8 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -1,15 +1,21 @@ #! /bin/bash if [ -z "$1"]; then - ARCH="amd64" + PYTHON="3.11" else - ARCH="$1" + PYTHON="$1" fi -if [ $ARCH == "amd64 "]; then +if [ -z "$2"]; then + ARCH="amd64" +else + ARCH="$2" +fi + +if [ -z "$3"]; then CONDA="x86_64" else - CONDA="$ARCH" + CONDA="$3" fi # Use RAM disk if possible @@ -94,7 +100,7 @@ rm Miniconda3-latest-MacOSX-$CONDA.sh export PATH="$HOME/miniconda/bin:$PATH" echo "Creating Conda env ..." -conda create -n novelWriter -c conda-forge python=3.11 --yes +conda create -n novelWriter -c conda-forge python=$PYTHON --yes source activate novelWriter echo "Installing dictionaries ..." From e27e066ccce1ec54cf650c4ff98d5f27be792253 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:12:51 +0200 Subject: [PATCH 04/15] Drop support for deprecated Linux AppImage --- .github/workflows/build.yml | 11 +++++------ pkgutils.py | 9 +-------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 879cc42f..31b98602 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,10 +40,9 @@ jobs: buildLinux: needs: buildAssets runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - linux-tag: ["manylinux_2_24_x86_64", "manylinux_2_28_x86_64"] + env: + PYTHON_VERSION: "3.12" + LINUX_TAG: "manylinux_2_28_x86_64" steps: - name: Python Setup uses: actions/setup-python@v5 @@ -64,12 +63,12 @@ jobs: path: novelwriter/assets - name: Build AppImage - run: python pkgutils.py build-appimage --linux-tag ${{ matrix.linux-tag }} --python-version ${{ matrix.python-version }} + run: python pkgutils.py build-appimage --linux-tag $LINUX_TAG --python-version $PYTHON_VERSION - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: AppImage-${{ matrix.python-version }}-${{ matrix.linux-tag }} + name: AppImage-$LINUX_TAG-$PYTHON_VERSION path: dist_appimage if-no-files-found: error retention-days: 14 diff --git a/pkgutils.py b/pkgutils.py index 328fe78a..cfd3c0bd 100755 --- a/pkgutils.py +++ b/pkgutils.py @@ -1073,15 +1073,8 @@ def makeAppImage(sysArgs: list[str]) -> list[str]: print("") sys.exit(1) - linuxLabel = "" - if not linuxTag.startswith("manylinux_2_28"): - linuxLabel = "-oldlinux" - if not linuxTag.endswith("x86_64"): - # manylinux_2_28 only comes in 64 bit, so this one only applies to older images - linuxLabel += "-32bit" - bldFile = glob.glob(f"{bldDir}/*.AppImage")[0] - outFile = f"{bldDir}/novelWriter-{pkgVers}{linuxLabel}.AppImage" + outFile = f"{bldDir}/novelWriter-{pkgVers}.AppImage" os.rename(bldFile, outFile) shaFile = makeCheckSum(os.path.basename(outFile), cwd=bldDir) From 2c1abf15199acfb054e9206ca469dcce45bccf74 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:18:11 +0200 Subject: [PATCH 05/15] Change package name --- .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 31b98602..6cd88322 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: AppImage-$LINUX_TAG-$PYTHON_VERSION + name: Linux-AppImage path: dist_appimage if-no-files-found: error retention-days: 14 From 48a7929254a3e67719ab88d9b1001cd019644946 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:28:57 +0200 Subject: [PATCH 06/15] Escape forwarding of arguments in MacoS build script --- setup/macos/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 8c127fc8..26d60b4d 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -144,7 +144,7 @@ echo "Creating entry script ..." cat > novelWriter.app/Contents/MacOS/novelWriter << EOF #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py $@ +$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py \$\@ EOF # Make it executable From 73b8443d7b1ca682a29526f7ca37d314ba23f82c Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:35:31 +0200 Subject: [PATCH 07/15] Let's try this one more time ... --- setup/macos/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 26d60b4d..589708a3 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -144,7 +144,7 @@ echo "Creating entry script ..." cat > novelWriter.app/Contents/MacOS/novelWriter << EOF #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py \$\@ +$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ EOF # Make it executable From 47a8dfbd93ff7ba34f719c3768eeeec8149062a1 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 19:35:39 +0200 Subject: [PATCH 08/15] Go back to macos-12 runner --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6cd88322..4050a6ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,7 +75,8 @@ jobs: buildMac-AMD64: needs: buildAssets - runs-on: macos-13 + # Stay on macos-12 due to https://github.com/create-dmg/create-dmg/issues/143 + runs-on: macos-12 env: PYTHON_VERSION: "3.12" ARCHITECTURE: amd64 From c362848b86d25db45897a3715684e4a2b209604c Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 19:41:33 +0200 Subject: [PATCH 09/15] Fix bash script bug --- setup/macos/build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 589708a3..eb7f5481 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -1,18 +1,18 @@ #! /bin/bash -if [ -z "$1"]; then +if [ -z "$1" ]; then PYTHON="3.11" else PYTHON="$1" fi -if [ -z "$2"]; then +if [ -z "$2" ]; then ARCH="amd64" else ARCH="$2" fi -if [ -z "$3"]; then +if [ -z "$3" ]; then CONDA="x86_64" else CONDA="$3" From 094ad1a17bcba7a78d874ee4dae8c2f68e955d57 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 19:44:50 +0200 Subject: [PATCH 10/15] Require input arguments --- setup/macos/build.sh | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/setup/macos/build.sh b/setup/macos/build.sh index eb7f5481..5afb161d 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -1,22 +1,13 @@ #! /bin/bash -if [ -z "$1" ]; then - PYTHON="3.11" -else - PYTHON="$1" +if [[ -z "$1" || -z "$2" || -z "$3" ]]; then + echo "Not enouch input arguments" + exit 1 fi -if [ -z "$2" ]; then - ARCH="amd64" -else - ARCH="$2" -fi - -if [ -z "$3" ]; then - CONDA="x86_64" -else - CONDA="$3" -fi +PYTHON="$1" +ARCH="$2" +CONDA="$3" # Use RAM disk if possible if [ -d /dev/shm ]; then From 07411327b6d85cbf4a83ec081e527a8c7595391d Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 19:50:45 +0200 Subject: [PATCH 11/15] Add some debug output --- setup/macos/build.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 5afb161d..15a47a3b 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -9,6 +9,10 @@ PYTHON="$1" ARCH="$2" CONDA="$3" +echo "Python Version: $PYTHON" +echo "Architecture: $ARCH" +echo "Miniconda Architecture: $CONDA" + # Use RAM disk if possible if [ -d /dev/shm ]; then TEMP_BASE=/dev/shm From e8bd9b21b552aaba2d6156ee4ac8853a4cccf507 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:31:04 +0200 Subject: [PATCH 12/15] Explicitly set python exec and ignore errors from run from source blocks in main --- novelwriter/__init__.py | 13 +++++-------- setup/macos/build.sh | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index 5866d801..c7ea96b5 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -32,7 +32,7 @@ from typing import TYPE_CHECKING from PyQt5.QtWidgets import QApplication, QErrorMessage from novelwriter.config import Config -from novelwriter.error import exceptionHandler, logException +from novelwriter.error import exceptionHandler from novelwriter.shared import SharedData if TYPE_CHECKING: # pragma: no cover @@ -198,24 +198,21 @@ def main(sysArgs: list | None = None) -> GuiMain | None: # Finish initialising config CONFIG.initConfig(confPath, dataPath) - if CONFIG.osDarwin: + if sys.platform == "darwin": try: from Foundation import NSBundle # type: ignore bundle = NSBundle.mainBundle() info = bundle.localizedInfoDictionary() or bundle.infoDictionary() info["CFBundleName"] = "novelWriter" except Exception: - logger.error("Failed to set application name") - logException() - - elif CONFIG.osWindows: + pass # Quietly ignore error + elif sys.platform == "win32": try: import ctypes appID = f"io.novelwriter.{__version__}" ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appID) # type: ignore except Exception: - logger.error("Failed to set application name") - logException() + pass # Quietly ignore error # Import GUI (after dependency checks), and launch from novelwriter.guimain import GuiMain diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 15a47a3b..fd6adf5f 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -139,7 +139,7 @@ echo "Creating entry script ..." cat > novelWriter.app/Contents/MacOS/novelWriter << EOF #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ +$DIR/../Resources/bin/python$PYTHON -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ EOF # Make it executable From 221b38c766a92e4d5a2b24753228d28c6d1a4a6a Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:36:09 +0200 Subject: [PATCH 13/15] Fix escapes in MacOS launch script --- setup/macos/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/macos/build.sh b/setup/macos/build.sh index fd6adf5f..fb33b47f 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -137,9 +137,9 @@ cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/ # Create entry script echo "Creating entry script ..." cat > novelWriter.app/Contents/MacOS/novelWriter << EOF +DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )" #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -$DIR/../Resources/bin/python$PYTHON -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ +\$DIR/../Resources/bin/python -sE \$DIR/../Resources/novelWriter/novelWriter.py \$@ EOF # Make it executable From d78643160cdcd3547001c5b8a42036e4931f9cf9 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:43:31 +0200 Subject: [PATCH 14/15] Update MacOS package names and fic another launch script bug --- .github/workflows/build.yml | 8 ++++---- setup/macos/build.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4050a6ea..79407646 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ jobs: runs-on: macos-12 env: PYTHON_VERSION: "3.12" - ARCHITECTURE: amd64 + PACKAGE_ARCH: x86_64 MINICONDA_ARCH: x86_64 steps: - name: Checkout @@ -92,7 +92,7 @@ jobs: path: novelwriter/assets - name: Build App Bundle - run: ./setup/macos/build.sh $PYTHON_VERSION $ARCHITECTURE $MINICONDA_ARCH + run: ./setup/macos/build.sh $PYTHON_VERSION $PACKAGE_ARCH $MINICONDA_ARCH - name: Upload DMG uses: actions/upload-artifact@v4 @@ -107,7 +107,7 @@ jobs: runs-on: macos-14 env: PYTHON_VERSION: "3.12" - ARCHITECTURE: arm64 + PACKAGE_ARCH: aarch64 MINICONDA_ARCH: arm64 steps: - name: Checkout @@ -120,7 +120,7 @@ jobs: path: novelwriter/assets - name: Build App Bundle - run: ./setup/macos/build.sh $PYTHON_VERSION $ARCHITECTURE $MINICONDA_ARCH + run: ./setup/macos/build.sh $PYTHON_VERSION $PACKAGE_ARCH $MINICONDA_ARCH - name: Upload DMG uses: actions/upload-artifact@v4 diff --git a/setup/macos/build.sh b/setup/macos/build.sh index fb33b47f..e57b3f8d 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -137,8 +137,8 @@ cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/ # Create entry script echo "Creating entry script ..." cat > novelWriter.app/Contents/MacOS/novelWriter << EOF -DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )" #!/bin/bash +DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )" \$DIR/../Resources/bin/python -sE \$DIR/../Resources/novelWriter/novelWriter.py \$@ EOF From b7ad2c969ac7f0e87df9ec2e75721087b5967a38 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:49:22 +0200 Subject: [PATCH 15/15] Fix test --- tests/test_base/test_base_init.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/test_base/test_base_init.py b/tests/test_base/test_base_init.py index 5326df7c..e828ce76 100644 --- a/tests/test_base/test_base_init.py +++ b/tests/test_base/test_base_init.py @@ -46,7 +46,6 @@ def testBaseInit_Launch(caplog, monkeypatch, fncPath): mp.setitem(sys.modules, "Foundation", None) nwGUI = main(["--testmode", f"--config={fncPath}", f"--data={fncPath}"]) assert isinstance(nwGUI, MockGuiMain) - assert "Failed" in caplog.text CONFIG.osDarwin = osDarwin @@ -58,9 +57,6 @@ def testBaseInit_Launch(caplog, monkeypatch, fncPath): mp.setitem(sys.modules, "ctypes", None) nwGUI = main(["--testmode", f"--config={fncPath}", f"--data={fncPath}"]) assert isinstance(nwGUI, MockGuiMain) - if not sys.platform.startswith("darwin"): - # For some reason, the test doesn't work on macOS - assert "Failed" in caplog.text CONFIG.osWindows = osWindows @@ -161,9 +157,9 @@ def testBaseInit_Imports(caplog, monkeypatch, fncPath): ["--testmode", f"--config={fncPath}", f"--data={fncPath}"] ) - assert ex.value.code & 4 == 4 # Python version not satisfied - assert ex.value.code & 8 == 8 # Qt version not satisfied - assert ex.value.code & 16 == 16 # PyQt version not satisfied + assert ex.value.code & 4 == 4 # Python version not satisfied # type: ignore + assert ex.value.code & 8 == 8 # Qt version not satisfied # type: ignore + assert ex.value.code & 16 == 16 # PyQt version not satisfied # type: ignore assert "At least Python" in caplog.messages[0] assert "At least Qt5" in caplog.messages[1]