Simplify argument parsing (#459)
With the current state of automation scripts, this is not possible anymore to launch script with multiple auto configs.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import logging
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from common import dates, http, releasedata
|
||||
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.
|
||||
|
||||
@@ -16,25 +17,25 @@ MANUAL_VERSIONS = {
|
||||
"7.2.0": dates.date(2023, 6, 1), # https://www.couchbase.com/blog/couchbase-capella-spring-release-72/
|
||||
}
|
||||
|
||||
for config in releasedata.list_configs_from_argv():
|
||||
with releasedata.ProductData(config.product) as product_data:
|
||||
html = http.fetch_html(f"{config.url}/current/install/install-intro.html")
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
html = http.fetch_html(f"{config.url}/current/install/install-intro.html")
|
||||
|
||||
minor_versions = [options.attrs["value"] for options in html.find(class_="version_list").find_all("option")]
|
||||
minor_version_urls = [f"{config.url}/{minor}/release-notes/relnotes.html" for minor in minor_versions]
|
||||
minor_versions = [options.attrs["value"] for options in html.find(class_="version_list").find_all("option")]
|
||||
minor_version_urls = [f"{config.url}/{minor}/release-notes/relnotes.html" for minor in minor_versions]
|
||||
|
||||
for minor_version in http.fetch_urls(minor_version_urls):
|
||||
minor_version_soup = BeautifulSoup(minor_version.text, features="html5lib")
|
||||
for minor_version in http.fetch_urls(minor_version_urls):
|
||||
minor_version_soup = BeautifulSoup(minor_version.text, features="html5lib")
|
||||
|
||||
for title in minor_version_soup.find_all("h2"):
|
||||
match = config.first_match(title.get_text().strip())
|
||||
if not match:
|
||||
logging.info(f"Skipping {title}, does not match any regex")
|
||||
continue
|
||||
for title in minor_version_soup.find_all("h2"):
|
||||
match = config.first_match(title.get_text().strip())
|
||||
if not match:
|
||||
logging.info(f"Skipping {title}, does not match any regex")
|
||||
continue
|
||||
|
||||
version = match["version"]
|
||||
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)
|
||||
version = match["version"]
|
||||
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)
|
||||
product_data.declare_versions(MANUAL_VERSIONS)
|
||||
|
||||
Reference in New Issue
Block a user