From d60fc2bdd00009b105a36de20997dc30b7afe664 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Thu, 11 Jun 2026 12:05:48 +0200 Subject: [PATCH] Support new graalpy asset names that include Python version. (#2863) * Support new graalpy asset names that include Python version * Slight readability improvement for graalpy asset regex --- bin/update_pythons.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/bin/update_pythons.py b/bin/update_pythons.py index 61ccdd80..dd6bb38c 100755 --- a/bin/update_pythons.py +++ b/bin/update_pythons.py @@ -124,14 +124,22 @@ class GraalPyVersions: response.raise_for_status() releases = response.json() - gp_version_re = re.compile(r"-(\d+\.\d+\.\d+)$") + gp_asset_re = re.compile( + r"^(?Pgraalpy(?P\d+\.\d+)?-(?P\d+\.\d+\.\d+))-" + ) cp_version_re = re.compile(r"Python (\d+\.\d+(?:\.\d+)?)") for release in releases: - m = gp_version_re.search(release["tag_name"]) - if m: - release["graalpy_version"] = Version(m.group(1)) - m = cp_version_re.search(release["body"]) - if m: + for asset in release["assets"]: + m = gp_asset_re.match(asset["name"]) + if m: + release["asset_prefix"] = m.group("prefix") + release["graalpy_version"] = Version(m.group("graalpy")) + if m.group("cpython"): + release["python_version"] = Version(m.group("cpython")) + break + if "python_version" not in release and ( + m := cp_version_re.search(release["body"] or "") + ): release["python_version"] = Version(m.group(1)) self.releases = [r for r in releases if "graalpy_version" in r and "python_version" in r] @@ -172,12 +180,11 @@ class GraalPyVersions: ext = "zip" if "win" in identifier else "tar.gz" for release in reversed(releases): version = release["python_version"] - gpversion = release["graalpy_version"] urls = [ rf["browser_download_url"] for rf in release["assets"] if rf["name"].endswith(f"{platform}-{arch}.{ext}") - and rf["name"].startswith(f"graalpy-{gpversion.major}") + and rf["name"].startswith(release["asset_prefix"]) ] if not urls: continue