An assortment of scripts and programs that pulls in info from our repositories and puts out a website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.4 KiB

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#Package in Arch [Communiy] python-feedgen . Not python-feedgenerator
from zoneinfo import ZoneInfo
except ModuleNotFoundError:
from backports.zoneinfo import ZoneInfo
from datetime import datetime, timezone, tzinfo
import sys
from feedgen.feed import FeedGenerator
except AttributeError:
import backports.datetime_fromisoformat
from backports.datetime_fromisoformat import MonkeyPatch
fg = FeedGenerator()
descs = {
"patroneo" : """Patroneo is an easy to use, pattern based midi sequencer.""",
"laborejo" : """Laborejo is a MIDI sequencer based on classical music notation.""",
"fluajho" : """Fluajho is a simple, standalone sf2 soundfont host/player.""",
"agordejo" : """Agordejo is a music and audio production session manager based on NSM.""",
"tembro" : """Tembro is a virtual software instrument based on samples. All instruments are permanently built-in.""",
if (not len(sys.argv) == 4) or not sys.argv[1] in descs or not sys.argv[2].endswith("/CHANGELOG") or not sys.argv[3].endswith("feed.atom"):
raise ValueError("Wrong number or wrong arguments: ./ patroneo /home/nils/lss/patroneo/CHANGELOG out/patroneo/feed.atom" )
project = sys.argv[1]
CHANGELOGFILE = sys.argv[2]
assert project in descs
description = descs[project]
print (f"Atom Feed Generation: {project}")"{project}/")
fg.title(f"{project.title()} Releases") {'name':'Laborejo Software Suite','email':''} ) href=f"{project}/", rel='alternate' )
fg.subtitle(description) href=f"{project}/feed.atom", rel="self" )
with open(CHANGELOGFILE) as fcl:
changelogData =
for cl in changelogData.split("\n\n\n"):
firstLine, changelog = cl.split("\n", maxsplit=1)
if firstLine.startswith("#Changelog"):
#preamble. skip
# Format:## YYYY-MM-DD major.minor.patch
assert "##" in firstLine, firstLine
markdownTitle, date, semVersion = firstLine.split(" ")
assert markdownTitle == "##", markdownTitle
assert date.count("-") == 2, date
assert semVersion.count(".") == 2, semVersion
print(firstLine, "parsed as date:", date, "with version:", semVersion)
semVersion = semVersion.strip()
isodate = datetime.fromisoformat(date.strip())
isodate = isodate.replace(tzinfo=ZoneInfo("UTC"))
fe = fg.add_entry()"{project}-{semVersion}")
fe.title(f"{project.title()} Version {semVersion}")"{project}-{semVersion}.tar.gz")"{project}")
cl = "</li>".join("<li>" + line.lstrip() for line in changelog.split("\n"))
desc = f"""
Download: <a href="{project}-{semVersion}.tar.gz">{project}-{semVersion}.tar.gz</a>
fe.content(desc, type="html")
atomfeed = fg.atom_str(pretty=True) # Get the ATOM feed as string
fg.atom_file(sys.argv[3]) # Write the ATOM feed to a file