- remove the use of environment variables to get directory paths, - make use of arguments / argparse instead of environment variables in `update.py` and `report.py`, - automatically guess the data directory in `latest.py` based on the script's location, - propagate log level to auto scripts, - move `list_configs_from_argv` from `endoflife` module to `releasedata` module, - use `list_products` in `latest.py` to load the product's frontmatters.
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
import logging
|
|
|
|
from common import dates, http, releasedata
|
|
|
|
"""Fetches LibreOffice versions from https://downloadarchive.documentfoundation.org/libreoffice/old/"""
|
|
|
|
for config in releasedata.list_configs_from_argv():
|
|
with releasedata.ProductData(config.product) as product_data:
|
|
html = http.fetch_html(config.url)
|
|
|
|
for table in html.find_all("table"):
|
|
for row in table.find_all("tr")[1:]:
|
|
cells = row.find_all("td")
|
|
if len(cells) < 4:
|
|
continue
|
|
|
|
version_str = cells[1].get_text().strip()
|
|
version_match = config.first_match(version_str)
|
|
if not version_match:
|
|
logging.warning(f"Skipping version {version_str} as it does not match any known version pattern")
|
|
continue
|
|
version = config.render(version_match)
|
|
|
|
date_str = cells[2].get_text().strip()
|
|
date = dates.parse_datetime(date_str)
|
|
|
|
product_data.declare_version(version, date)
|