asterisk: update the update script version regex

This commit is contained in:
Theodore Ni 2023-07-14 17:29:10 -07:00
parent 46f3dff227
commit c5240d9775
No known key found for this signature in database
GPG Key ID: 48B67583BDDD4474

View File

@ -7,14 +7,14 @@ import re, requests, json
import os, sys
from pathlib import Path
URL = "https://downloads.asterisk.org/pub/telephony/asterisk"
URL = "https://downloads.asterisk.org/pub/telephony/asterisk/"
page = requests.get(URL)
changelog = re.compile("^ChangeLog-\d+\.\d+\.\d+$")
changelog = re.compile("^ChangeLog-\d+\.\d+\.\d+\.md$")
changelogs = [a.get_text() for a in BeautifulSoup(page.text, 'html.parser').find_all('a') if changelog.match(a.get_text())]
major_versions = {}
for changelog in changelogs:
v = version.parse(changelog.removeprefix("ChangeLog-"))
v = version.parse(changelog.removeprefix("ChangeLog-").removesuffix(".md"))
major_versions.setdefault(v.major, []).append(v)
out = {}