Add new declare method (#461)
For manually declare (or overwrite) missing or erroneous versions.
This commit is contained in:
@@ -30,11 +30,7 @@ with ProductData(config.product) as product_data:
|
||||
except ValueError:
|
||||
deprecation_date = None
|
||||
|
||||
if identifier == "nodejs4.3-edge":
|
||||
# there is a mistake in the data: block function update date cannot be before the deprecation date
|
||||
block_function_update_str = "2020-04-30"
|
||||
else:
|
||||
block_function_update_str = cells[block_function_update_index].get_text().strip()
|
||||
block_function_update_str = cells[block_function_update_index].get_text().strip()
|
||||
try:
|
||||
block_function_update = dates.parse_date(block_function_update_str)
|
||||
except ValueError:
|
||||
|
||||
@@ -3,25 +3,11 @@ import re
|
||||
from common import dates, http
|
||||
from common.releasedata import ProductData, config_from_argv
|
||||
|
||||
"""Fetches versions from Adobe ColdFusion release notes on helpx.adobe.com.
|
||||
|
||||
x.y.0 release dates are unfortunately not available in the release notes and have to updated them manually each time a
|
||||
new minor version is released.
|
||||
"""
|
||||
"""Fetches versions from Adobe ColdFusion release notes on helpx.adobe.com."""
|
||||
|
||||
VERSION_AND_DATE_PATTERN = re.compile(r"Release Date[,|:]? (.*?)\).*?Build Number: (.*?)$",
|
||||
re.DOTALL | re.MULTILINE | re.IGNORECASE)
|
||||
|
||||
# .0 release dates are not available in the release notes.
|
||||
FIXED_VERSIONS = {
|
||||
"10.0.0": dates.date(2012, 5, 15), # https://en.wikipedia.org/wiki/Adobe_ColdFusion#Adobe_ColdFusion_10
|
||||
"11.0.0": dates.date(2014, 4, 29), # https://en.wikipedia.org/wiki/Adobe_ColdFusion#Adobe_ColdFusion_11
|
||||
"2016.0.0": dates.date(2016, 2, 16), # https://en.wikipedia.org/wiki/Adobe_ColdFusion#Adobe_ColdFusion_(2016_Release)
|
||||
"2018.0.0": dates.date(2018, 7, 12), # https://coldfusion.adobe.com/2018/07/new-coldfusion-release-adds-performance-monitoring-toolset-for-measuring-monitoring-and-managing-high-performing-web-apps/
|
||||
"2021.0.0": dates.date(2020, 11, 11), # https://community.adobe.com/t5/coldfusion-discussions/introducing-adobe-coldfusion-2021-release/m-p/11585468
|
||||
"2023.0.0": dates.date(2022, 5, 16), # https://coldfusion.adobe.com/2023/05/coldfusion2023-release/
|
||||
}
|
||||
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
html = http.fetch_html(config.url)
|
||||
@@ -32,5 +18,3 @@ with ProductData(config.product) as product_data:
|
||||
date = dates.parse_date(date_str)
|
||||
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)
|
||||
|
||||
@@ -2,7 +2,7 @@ import argparse
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
from datetime import date, datetime, timezone
|
||||
from pathlib import Path
|
||||
from types import TracebackType
|
||||
from typing import Optional, Type
|
||||
@@ -62,6 +62,7 @@ class ProductRelease:
|
||||
|
||||
def set_field(self, field: str, new_value: any) -> None:
|
||||
new_value = new_value.strftime("%Y-%m-%d") if isinstance(new_value, datetime) else new_value
|
||||
new_value = new_value.strftime("%Y-%m-%d") if isinstance(new_value, date) else new_value
|
||||
old_value = self.data.get(field, None)
|
||||
if old_value != new_value:
|
||||
self.data[field] = new_value
|
||||
@@ -178,10 +179,6 @@ class ProductData:
|
||||
logging.info(f"adding version {version} ({date}) to {self}")
|
||||
self.versions[version] = ProductVersion.of(self.name, version, date)
|
||||
|
||||
def declare_versions(self, dates_by_version: dict[str, datetime]) -> None:
|
||||
for (version, date) in dates_by_version.items():
|
||||
self.declare_version(version, date)
|
||||
|
||||
def remove_version(self, version: str) -> None:
|
||||
if version not in self.versions:
|
||||
logging.warning(f"version {version} cannot be removed as it does not exist for {self}")
|
||||
|
||||
@@ -4,18 +4,7 @@ from bs4 import BeautifulSoup
|
||||
from common import dates, http
|
||||
from common.releasedata import ProductData, config_from_argv
|
||||
|
||||
"""Fetches versions from release notes of each minor version on docs.couchbase.com.
|
||||
|
||||
Dates are not available for all versions, so they must be set manually in some cases.
|
||||
Moreover dates are not accurate (only month and year are provided), so they are set to the last day of the month.
|
||||
"""
|
||||
|
||||
MANUAL_VERSIONS = {
|
||||
"6.0.0": dates.date(2018, 10, 31), # https://www.couchbase.com/blog/announcing-couchbase-6-0/
|
||||
"6.0.1": dates.date(2019, 2, 15), # https://web.archive.org/web/20190307191211/https://docs.couchbase.com/server/6.0/release-notes/relnotes.html
|
||||
"6.6.0": dates.date(2020, 8, 12), # https://www.couchbase.com/blog/whats-new-and-improved-in-couchbase-server-6-6/
|
||||
"7.2.0": dates.date(2023, 6, 1), # https://www.couchbase.com/blog/couchbase-capella-spring-release-72/
|
||||
}
|
||||
"""Fetches versions from release notes of each minor version on docs.couchbase.com."""
|
||||
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
@@ -37,5 +26,3 @@ with ProductData(config.product) as product_data:
|
||||
version = f"{version}.0" if len(version.split(".")) == 2 else version
|
||||
date = dates.parse_month_year_date(match['date'])
|
||||
product_data.declare_version(version, date)
|
||||
|
||||
product_data.declare_versions(MANUAL_VERSIONS)
|
||||
|
||||
16
src/declare.py
Normal file
16
src/declare.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from datetime import datetime
|
||||
|
||||
from common.releasedata import ProductData, config_from_argv
|
||||
|
||||
"""Manually declare missing or erroneous versions."""
|
||||
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
for version in config.data.get("versions", []):
|
||||
product_data.declare_version(version['name'], version['date'])
|
||||
|
||||
releases: list[dict[str, str | bool | datetime]] = config.data.get("releases", [])
|
||||
for release in releases:
|
||||
release_data = product_data.get_release(release.pop("name"))
|
||||
for key, value in release.items():
|
||||
release_data.set_field(key, value)
|
||||
Reference in New Issue
Block a user