From 0ccdcd3f0f568269ad5bc622fb14404694e3a3c0 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto
Date: Tue, 19 Dec 2023 07:44:07 -0800
Subject: [PATCH] dist/macos: appcast needs namespace, better formatting
---
dist/macos/update_appcast_tip.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dist/macos/update_appcast_tip.py b/dist/macos/update_appcast_tip.py
index ec3878bc1..fae10c627 100644
--- a/dist/macos/update_appcast_tip.py
+++ b/dist/macos/update_appcast_tip.py
@@ -35,6 +35,9 @@ with open("sign_update.txt", "r") as f:
value = value[1:-1]
attrs[key] = value
+# We need to register our namespaces before reading or writing any files.
+ET.register_namespace("sparkle", "http://www.andymatuschak.org/xml-namespaces/sparkle")
+
# Open our existing appcast and find the channel element. This is where
# we'll add our new item.
et = ET.parse('appcast.xml')
@@ -54,7 +57,7 @@ elem = ET.SubElement(item, "sparkle:minimumSystemVersion")
elem.text = "12.0.0"
elem = ET.SubElement(item, "description")
elem.text = f"""
-Automated build from commit
{commit}
.
+Automated build from commit {commit}
.
"""
elem = ET.SubElement(item, "enclosure")
elem.set("url", f"https://tip.files.ghostty.dev/{build}/ghostty-macos-universal.zip")
@@ -63,4 +66,4 @@ for key, value in attrs.items():
elem.set(key, value)
# Output the new appcast.
-et.write("appcast_new.xml")
+et.write("appcast_new.xml", xml_declaration=True, encoding="utf-8")