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:
19
src/typo3.py
19
src/typo3.py
@@ -1,11 +1,12 @@
|
||||
from common import dates, http, releasedata
|
||||
from common import dates, endoflife, http, releasedata
|
||||
|
||||
with releasedata.ProductData("typo3") as product_data:
|
||||
data = http.fetch_url("https://get.typo3.org/api/v1/release/").json()
|
||||
for v in data:
|
||||
if v['type'] == 'development':
|
||||
continue
|
||||
for config in endoflife.list_configs_from_argv():
|
||||
with releasedata.ProductData(config.product) as product_data:
|
||||
data = http.fetch_url(config.url).json()
|
||||
for v in data:
|
||||
if v['type'] == 'development':
|
||||
continue
|
||||
|
||||
version = v["version"]
|
||||
date = dates.parse_datetime(v["date"], to_utc=False) # utc kept for now for backwards compatibility
|
||||
product_data.declare_version(version, date)
|
||||
version = v["version"]
|
||||
date = dates.parse_datetime(v["date"], to_utc=False) # utc kept for now for backwards compatibility
|
||||
product_data.declare_version(version, date)
|
||||
|
||||
Reference in New Issue
Block a user