Update release-data JSON file format (#274)

This makes the format open for extension, such as adding release cycle level data (such as EOL dates).

Version data is still accessible by the version's name. While this repeats the version name, it's also much more convenient for users of those data.

A few other things have also been updated in the process:

- verbosity of the diff has been increased in update.py to make workflow summaries more readable,
- dates without timezone are now set to UTC by default (this was already supposed, so no impact expected here).
This commit is contained in:
Marc Wrobel
2023-12-31 18:30:35 +01:00
parent b79b71518d
commit 74678a75c3
225 changed files with 184985 additions and 46158 deletions

View File

@@ -44,8 +44,14 @@ def parse_datetime(text: str, formats: list[str] = frozenset([
text = text.strip().replace(", ", " ").replace(". ", " ").replace("(", "").replace(")", "")
for fmt in formats:
try:
date = datetime.strptime(text, fmt) # NOQA: DTZ007, timezone is handled below
return date.astimezone(timezone.utc) if to_utc else date
dt = datetime.strptime(text, fmt) # NOQA: DTZ007, timezone is handled below
if to_utc:
dt = dt.astimezone(timezone.utc)
elif dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
return dt
except ValueError:
pass