[apache-http-server] Refactor script (#212)

Make the script more readable, mostly by:

- using the endoflife.Product class,
- removing the unnecessary use of functions,
- renaming a few variables,
- declaring a constant for regexes.
This commit is contained in:
Marc Wrobel
2023-12-10 13:19:17 +01:00
committed by GitHub
parent 06c462c3cc
commit 7d462ffe90
2 changed files with 25 additions and 49 deletions

View File

@@ -7,7 +7,7 @@ from common import endoflife
"""Fetches Amazon Neptune versions from its RSS feed on docs.aws.amazon.com."""
RSS_URL = "https://docs.aws.amazon.com/neptune/latest/userguide/rssupdates.rss"
VERSION_REGEX = re.compile(r"^Engine version (?P<version>[0-9R.]+)$")
VERSION_PATTERN = re.compile(r"^Engine version (?P<version>[0-9R.]+)$")
product = endoflife.Product("amazon-neptune")
print(f"::group::{product.name}")
@@ -18,7 +18,7 @@ for entry in rss.getElementsByTagName("item"):
version_str = entry.getElementsByTagName("title")[0].firstChild.nodeValue
date_str = entry.getElementsByTagName("pubDate")[0].firstChild.nodeValue
version_match = VERSION_REGEX.match(version_str)
version_match = VERSION_PATTERN.match(version_str)
if version_match:
product.declare_version(version_match['version'], dates.parse_datetime(date_str))