Align custom scripts with generic scripts (#445)
Align custom scripts with generic scripts, making them configurable. This has a few advantages: - script code is more unified, - no more hard-coded method names in scripts, which is less error prone and make it easier to rename scripts, - no more hard coded product names in scripts, which is less error prone and make it easier to rename products, - less hard-coded URLs and regexes in scripts, which makes auto-configuration more expressive / updatable, Also added method `endoflife.list_configs_from_argv()` so that it is easier to manipulate scripts arguments.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import re
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from common import dates, http, releasedata
|
||||
from common import dates, endoflife, http, releasedata
|
||||
|
||||
"""Fetches versions from Adobe ColdFusion release notes on helpx.adobe.com.
|
||||
|
||||
@@ -9,15 +9,6 @@ x.y.0 release dates are unfortunately not available in the release notes and hav
|
||||
new minor version is released.
|
||||
"""
|
||||
|
||||
URLS = [
|
||||
"https://helpx.adobe.com/coldfusion/kb/coldfusion-10-updates.html",
|
||||
"https://helpx.adobe.com/coldfusion/kb/coldfusion-11-updates.html",
|
||||
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2016-updates.html",
|
||||
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2018-updates.html",
|
||||
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2021-updates.html",
|
||||
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2023-updates.html",
|
||||
]
|
||||
|
||||
VERSION_AND_DATE_PATTERN = re.compile(r"Release Date[,|:]? (.*?)\).*?Build Number: (.*?)$",
|
||||
re.DOTALL | re.MULTILINE | re.IGNORECASE)
|
||||
|
||||
@@ -31,8 +22,9 @@ FIXED_VERSIONS = {
|
||||
"2023.0.0": dates.date(2022, 5, 16), # https://coldfusion.adobe.com/2023/05/coldfusion2023-release/
|
||||
}
|
||||
|
||||
with releasedata.ProductData("coldfusion") as product_data:
|
||||
for changelog in http.fetch_urls(URLS):
|
||||
for config in endoflife.list_configs_from_argv():
|
||||
with releasedata.ProductData(config.product) as product_data:
|
||||
changelog = http.fetch_url(config.url)
|
||||
changelog_soup = BeautifulSoup(changelog.text, features="html5lib")
|
||||
|
||||
for p in changelog_soup.findAll("div", class_="text"):
|
||||
@@ -42,4 +34,4 @@ with releasedata.ProductData("coldfusion") as product_data:
|
||||
version = version_str.strip().replace(",", ".") # 11,0,0,289974 -> 11.0.0.289974
|
||||
product_data.declare_version(version, date)
|
||||
|
||||
product_data.declare_versions(FIXED_VERSIONS)
|
||||
product_data.declare_versions(FIXED_VERSIONS)
|
||||
|
||||
Reference in New Issue
Block a user