Ensure appdata releases tag is replaced rather than added

This commit is contained in:
gasinvein 2022-01-25 15:32:13 +04:00 committed by John Preston
parent 6af255923a
commit 4ca3f6a1b3

View File

@ -54,7 +54,11 @@ def get_changelog_xml(changelog, max_items=None):
def update_appdata(appdata_path, changelog, max_items=None):
appdata = ET.parse(appdata_path)
appdata.getroot().append(
root = appdata.getroot()
releases = root.find("releases")
if releases is not None:
root.remove(releases)
root.append(
get_changelog_xml(changelog, max_items)
)
appdata.write(appdata_path, encoding="utf-8", xml_declaration=True)