Files
endoflife-date-release-data/src/rockylinux.py
Marc Wrobel 0d17306872 Simplify date parsing (#195)
Create common functions parse_date, parse_month_year_date and parse_datetime.

Those functions support trying multiple formats, and come with default formats lists that support most of the date format encountered so far.

Notable change: year-month dates are now set to the end of month (impacted couchbase-server and ibm-aix).
2023-11-26 21:01:35 +01:00

34 lines
927 B
Python

import re
from common import dates
from common import endoflife
URL = "https://raw.githubusercontent.com/rocky-linux/wiki.rockylinux.org/development/docs/include/releng/version_table.md"
REGEX = r"^(\d+\.\d+)$"
def parse_date(date_str):
date_str = date_str.replace(',', '').strip()
return dates.parse_date(date_str).strftime("%Y-%m-%d")
def parse_markdown_table(table_text):
lines = table_text.strip().split('\n')
versions = {}
for line in lines:
items = line.split('|')
if len(items) >=5 and re.match(REGEX, items[1].strip()):
version = items[1].strip()
date = parse_date(items[3])
print(f"{version}: {date}")
versions[version] = date
return versions
print("::group::rockylinux")
response = endoflife.fetch_url(URL)
versions = parse_markdown_table(response)
endoflife.write_releases('rockylinux', versions)
print("::endgroup::")