|
6 | 6 | from pathlib import Path
|
7 | 7 |
|
8 | 8 | import requests
|
| 9 | +from packaging.version import Version |
9 | 10 |
|
10 | 11 | DIR = Path(__file__).parent.resolve()
|
11 | 12 | RESOURCES = DIR.parent / "cibuildwheel/resources"
|
@@ -53,6 +54,8 @@ class Image:
|
53 | 54 | Image("manylinux_2_28", "s390x", "quay.io/pypa/manylinux_2_28_s390x", None),
|
54 | 55 | Image("manylinux_2_28", "pypy_x86_64", "quay.io/pypa/manylinux_2_28_x86_64", None),
|
55 | 56 | Image("manylinux_2_28", "pypy_aarch64", "quay.io/pypa/manylinux_2_28_aarch64", None),
|
| 57 | + # manylinux_2_31 images |
| 58 | + Image("manylinux_2_31", "armv7l", "ghcr.io/mayeut/manylinux_2_31", None), |
56 | 59 | # musllinux_1_1 images
|
57 | 60 | Image("musllinux_1_1", "x86_64", "quay.io/pypa/musllinux_1_1_x86_64", None),
|
58 | 61 | Image("musllinux_1_1", "i686", "quay.io/pypa/musllinux_1_1_i686", None),
|
@@ -91,6 +94,21 @@ class Image:
|
91 | 94 | for (name, info) in tags_dict.items()
|
92 | 95 | if info["manifest_digest"] == latest_tag["manifest_digest"]
|
93 | 96 | )
|
| 97 | + elif image.image_name.startswith("ghcr.io/"): |
| 98 | + repository = image.image_name[8:] |
| 99 | + response = requests.get( |
| 100 | + "https://ghcr.io/token", params={"scope": f"repository:{repository}:pull"} |
| 101 | + ) |
| 102 | + response.raise_for_status() |
| 103 | + token = response.json()["token"] |
| 104 | + response = requests.get( |
| 105 | + f"https://ghcr.io/v2/{repository}/tags/list", |
| 106 | + headers={"Authorization": f"Bearer {token}"}, |
| 107 | + ) |
| 108 | + response.raise_for_status() |
| 109 | + ghcr_tags = [(Version(tag), tag) for tag in response.json()["tags"] if tag != "latest"] |
| 110 | + ghcr_tags.sort(reverse=True) |
| 111 | + tag_name = ghcr_tags[0][1] |
94 | 112 | else:
|
95 | 113 | response = requests.get(f"https://hub.docker.com/v2/repositories/{image.image_name}/tags")
|
96 | 114 | response.raise_for_status()
|
|
0 commit comments