Files
endoflife-date-release-data/src/git.py
Marc Wrobel 56cc29b49d Make releasedata.Product usable in 'with' expression (#294)
This way the writing of the JSON file is handled automatically if the update does not fail.
It pave the way to further global improvements, such as a better error handling.
2024-02-04 14:48:05 +01:00

24 lines
840 B
Python

import sys
from common import dates, endoflife, releasedata
from common.git import Git
"""Fetches versions from tags in a git repository. This replace the old update.rb script."""
METHOD = 'git'
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
for product in endoflife.list_products(METHOD, p_filter):
with releasedata.ProductData(product.name) as product_data:
for config in product.get_auto_configs(METHOD):
git = Git(config.url)
git.setup(bare=True)
tags = git.list_tags()
for tag, date_str in tags:
version_match = config.first_match(tag)
if version_match:
version = config.render(version_match)
date = dates.parse_date(date_str)
product_data.declare_version(version, date)