Skip to content

Commit

Permalink
Add support for ARM images for Mac
Browse files Browse the repository at this point in the history
vkbo committed Apr 21, 2024
1 parent 454467c commit 1f2f7ae
Showing 8 changed files with 61 additions and 30 deletions.
3 changes: 2 additions & 1 deletion source/_extra/release-latest.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@
"appimage": "https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4.AppImage",
"debian": "https://github.com/vkbo/novelWriter/releases/download/v2.4/novelwriter_2.4_all.deb",
"winexe": "https://github.com/vkbo/novelWriter/releases/download/v2.4/novelwriter-2.4-amd64-setup.exe",
"macdmg": "https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-amd64.dmg",
"macx86": "https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-x86_64.dmg",
"macarm": "https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-aarch64.dmg",
"zipball": "https://api.github.com/repos/vkbo/novelWriter/zipball/v2.4",
"tarball": "https://api.github.com/repos/vkbo/novelWriter/tarball/v2.4"
}
8 changes: 5 additions & 3 deletions source/generated/checksum_block.rst
Original file line number Diff line number Diff line change
@@ -7,8 +7,10 @@ Sha256 Checksums
| Sha256: ``a0f343d1494e5d60edcb741e79b0617f9cdb0e195beef10629f04c4cb0667b5f`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelwriter_2.4_all.deb.sha256>`__
* | **Windows Installer:** novelwriter-2.4-amd64-setup.exe
| Sha256: ``1589127a67acf41b242338250b7949a08f7510470d430425d96f45968a238068`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelwriter-2.4-amd64-setup.exe.sha256>`__
* | **MacOS DMG Image:** novelWriter-2.4-amd64.dmg
| Sha256: ``112a43f8614be36b2a59c1ab4d77dee6621603b72c5376dc18bb6ccba8104f94`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-amd64.dmg.sha256>`__
* | **MacOS DMG Image (Intel):** novelWriter-2.4-x86_64.dmg
| Sha256: ``112a43f8614be36b2a59c1ab4d77dee6621603b72c5376dc18bb6ccba8104f94`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-x86_64.dmg.sha256>`__
* | **MacOS DMG Image (M1):** novelWriter-2.4-aarch64.dmg
| Sha256: ``0099661ede689bc51efca48c9fe5787d68d752ccb7326b306de58486ebbce5e4`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-aarch64.dmg.sha256>`__
.. rubric:: Verify the Checksum

@@ -40,4 +42,4 @@ Sha256 Checksums
.. code-block:: bash
shasum -c novelWriter-2.4-amd64.dmg.sha256
shasum -c novelWriter-2.4-x86_64.dmg.sha256
3 changes: 2 additions & 1 deletion source/generated/download_block.rst
Original file line number Diff line number Diff line change
@@ -70,7 +70,8 @@ Latest Release
:columns: 7

| **Download**
| :octicon:`download` `DMG Image <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-amd64.dmg>`__
| :octicon:`download` `DMG Image (Intel) <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-x86_64.dmg>`__
| :octicon:`download` `DMG Image (M1) <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-aarch64.dmg>`__
| :octicon:`light-bulb` :ref:`Install Help <a_started_macos>`
.. grid-item::
15 changes: 11 additions & 4 deletions source/generated/download_release.rst
Original file line number Diff line number Diff line change
@@ -44,11 +44,18 @@ Windows
MacOS
-----

**DMG Image**
This is a DMG image for MacOS, and should work on at least MacOS 12 or higher.
**DMG Image for Intel**
This is a DMG image for MacOS with x86_64 architecture. It is built on MacOS 12.

| **Download:** :octicon:`download` `novelWriter-2.4-amd64.dmg <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-amd64.dmg>`__ [ 93.7 MB ]
| **Checksum:** :octicon:`hash` ``112a43f8614be36b2a59c1ab4d77dee6621603b72c5376dc18bb6ccba8104f94`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-amd64.dmg.sha256>`__
| **Download:** :octicon:`download` `novelWriter-2.4-x86_64.dmg <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-x86_64.dmg>`__ [ 93.7 MB ]
| **Checksum:** :octicon:`hash` ``112a43f8614be36b2a59c1ab4d77dee6621603b72c5376dc18bb6ccba8104f94`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-x86_64.dmg.sha256>`__

**DMG Image for Apple Silicon (M1)**
This is a DMG image for MacOS with aarch64 architecture. It is built on MacOS 14.

| **Download:** :octicon:`download` `novelWriter-2.4-aarch64.dmg <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-aarch64.dmg>`__ [ 71.5 MB ]
| **Checksum:** :octicon:`hash` ``0099661ede689bc51efca48c9fe5787d68d752ccb7326b306de58486ebbce5e4`` :octicon:`download` `ShaSum File <https://github.com/vkbo/novelWriter/releases/download/v2.4/novelWriter-2.4-aarch64.dmg.sha256>`__

Other Packages
8 changes: 5 additions & 3 deletions templates/checksum_block.rst
Original file line number Diff line number Diff line change
@@ -7,8 +7,10 @@ Sha256 Checksums
| Sha256: ``{debian_shasum}`` :octicon:`download` `ShaSum File <{debian_shasumfile}>`__
* | **Windows Installer:** {winexe_name}
| Sha256: ``{winexe_shasum}`` :octicon:`download` `ShaSum File <{winexe_shasumfile}>`__
* | **MacOS DMG Image:** {macdmg_name}
| Sha256: ``{macdmg_shasum}`` :octicon:`download` `ShaSum File <{macdmg_shasumfile}>`__
* | **MacOS DMG Image (Intel):** {macx86_name}
| Sha256: ``{macx86_shasum}`` :octicon:`download` `ShaSum File <{macx86_shasumfile}>`__
* | **MacOS DMG Image (M1):** {macarm_name}
| Sha256: ``{macarm_shasum}`` :octicon:`download` `ShaSum File <{macarm_shasumfile}>`__
.. rubric:: Verify the Checksum

@@ -40,4 +42,4 @@ Sha256 Checksums
.. code-block:: bash
shasum -c {macdmg_name}.sha256
shasum -c {macx86_name}.sha256
3 changes: 2 additions & 1 deletion templates/download_block.rst
Original file line number Diff line number Diff line change
@@ -70,7 +70,8 @@ Latest Release
:columns: 7

| **Download**
| :octicon:`download` `DMG Image <{macdmg_download}>`__
| :octicon:`download` `DMG Image (Intel) <{macx86_download}>`__
| :octicon:`download` `DMG Image (M1) <{macarm_download}>`__
| :octicon:`light-bulb` :ref:`Install Help <a_started_macos>`
.. grid-item::
31 changes: 21 additions & 10 deletions tools/assets.py
Original file line number Diff line number Diff line change
@@ -17,8 +17,9 @@ class AssetType(Enum):
APP_IMAGE_OLD = 2
DEBIAN = 3
WINDOWS_EXE = 4
MAC_DMG = 5
PYTHON_WHEEL = 6
MAC_DMG_INTEL = 5
MAC_DMG_ARM = 6
PYTHON_WHEEL = 7

# END Enum AssetType

@@ -51,9 +52,13 @@ class AssetOS(Enum):
"Setup Installer",
"This is a standard setup installer for Windows. It is made for Windows 10 or newer."
),
AssetType.MAC_DMG: (
"DMG Image",
"This is a DMG image for MacOS, and should work on at least MacOS 12 or higher."
AssetType.MAC_DMG_INTEL: (
"DMG Image for Intel",
"This is a DMG image for MacOS with x86_64 architecture. It is built on MacOS 12."
),
AssetType.MAC_DMG_ARM: (
"DMG Image for Apple Silicon (M1)",
"This is a DMG image for MacOS with aarch64 architecture. It is built on MacOS 14."
),
AssetType.PYTHON_WHEEL: (
"Python Wheel",
@@ -143,8 +148,11 @@ def _processAsset(self):
elif name.endswith("setup.exe"):
self._type = AssetType.WINDOWS_EXE
self._os = AssetOS.WINDOWS
elif name.endswith(".dmg"):
self._type = AssetType.MAC_DMG
elif name.endswith(".dmg") and "x86_64" in name:
self._type = AssetType.MAC_DMG_INTEL
self._os = AssetOS.MACOS
elif name.endswith(".dmg") and "aarch64" in name:
self._type = AssetType.MAC_DMG_ARM
self._os = AssetOS.MACOS
elif name.endswith(".whl"):
self._type = AssetType.PYTHON_WHEEL
@@ -184,12 +192,13 @@ class DownloadAssets:

def __init__(self, data):
self._raw = data
self._assets = {
self._assets: dict[AssetType, Asset | None] = {
AssetType.APP_IMAGE: None,
AssetType.APP_IMAGE_OLD: None,
AssetType.DEBIAN: None,
AssetType.WINDOWS_EXE: None,
AssetType.MAC_DMG: None,
AssetType.MAC_DMG_INTEL: None,
AssetType.MAC_DMG_ARM: None,
AssetType.PYTHON_WHEEL: None,
}
for asset in data.get("assets", []):
@@ -240,7 +249,9 @@ def appendType(aType, target):
buffer.append("MacOS")
buffer.append("-----")
buffer.append("")
appendType(AssetType.MAC_DMG, buffer)
appendType(AssetType.MAC_DMG_INTEL, buffer)
buffer.append("")
appendType(AssetType.MAC_DMG_ARM, buffer)
buffer.append("")
buffer.append("Other Packages")
buffer.append("--------------")
20 changes: 13 additions & 7 deletions update.py
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ def updateSetting(name: str, value: str) -> None:
return


def writeReleaseInfo(version: str, force: bool, info: dict[str, str]) -> None:
def writeReleaseInfo(version: str, force: bool, info: dict[str, str | dict[str, str]]) -> None:
"""Write the release info file."""
relFile = Path("source/_extra/release-latest.json")
current = json.loads(relFile.read_text(encoding="utf-8")) if relFile.exists() else {}
@@ -195,7 +195,8 @@ def pullRelease(args):
aAppImg = assets.getAsset(AssetType.APP_IMAGE)
aDebian = assets.getAsset(AssetType.DEBIAN)
aWinExe = assets.getAsset(AssetType.WINDOWS_EXE)
aMacDmg = assets.getAsset(AssetType.MAC_DMG)
aMacAMD = assets.getAsset(AssetType.MAC_DMG_INTEL)
aMacARM = assets.getAsset(AssetType.MAC_DMG_ARM)

if isPreRelease:
# Updating Pre-Release Info
@@ -220,7 +221,8 @@ def pullRelease(args):
"appimage": aAppImg.assetUrl,
"debian": aDebian.assetUrl,
"winexe": aWinExe.assetUrl,
"macdmg": aMacDmg.assetUrl,
"macx86": aMacAMD.assetUrl,
"macarm": aMacARM.assetUrl,
"zipball": zipBall,
"tarball": tarBall,
}
@@ -234,7 +236,8 @@ def pullRelease(args):
"appimage_download": aAppImg.assetUrl,
"debian_download": aDebian.assetUrl,
"winexe_download": aWinExe.assetUrl,
"macdmg_download": aMacDmg.assetUrl,
"macx86_download": aMacAMD.assetUrl,
"macarm_download": aMacARM.assetUrl,
})

buildFromTemplate("checksum_block.rst", "checksum_block.rst", {
@@ -247,9 +250,12 @@ def pullRelease(args):
"winexe_name": aWinExe.assetName,
"winexe_shasum": aWinExe.assetShaSum,
"winexe_shasumfile": aWinExe.assetShaSumUrl,
"macdmg_name": aMacDmg.assetName,
"macdmg_shasum": aMacDmg.assetShaSum,
"macdmg_shasumfile": aMacDmg.assetShaSumUrl,
"macx86_name": aMacAMD.assetName,
"macx86_shasum": aMacAMD.assetShaSum,
"macx86_shasumfile": aMacAMD.assetShaSumUrl,
"macarm_name": aMacARM.assetName,
"macarm_shasum": aMacARM.assetShaSum,
"macarm_shasumfile": aMacARM.assetShaSumUrl,
})

buildFromTemplate("download_release.rst", "download_release.rst", {

0 comments on commit 1f2f7ae

Please sign in to comment.