Skip to content

Commit 81e5bdd

Browse files
committed
chore: update python toolchains
- use the SHA256SUMS file instead of individual sha256sum files. This improves the speed of the tooling and also the old files just disappeared for the latest toolchain release. - update to the latest release.
1 parent 7685993 commit 81e5bdd

File tree

4 files changed

+107
-110
lines changed

4 files changed

+107
-110
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ END_UNRELEASED_TEMPLATE
6060
* (gazelle) Types for exposed members of `python.ParserOutput` are now all public.
6161
* (gazelle) Removed the requirement for `__init__.py`, `__main__.py`, or `__test__.py` files to be
6262
present in a directory to generate a `BUILD.bazel` file.
63-
* (toolchain) Updated the following toolchains to build 20250702 to patch CVE-2025-47273:
63+
* (toolchain) Updated the following toolchains to build 20250708 to patch CVE-2025-47273:
6464
* 3.9.23
6565
* 3.10.18
6666
* 3.11.13
6767
* 3.12.11
68-
* 3.14.0b3
68+
* 3.14.0b4
6969
* (toolchain) Python 3.13 now references 3.13.5
7070

7171
{#v0-0-0-fixed}
@@ -101,7 +101,7 @@ END_UNRELEASED_TEMPLATE
101101
* 3.11.13
102102
* 3.12.11
103103
* 3.13.5
104-
* 3.14.0b3
104+
* 3.14.0b4
105105

106106
{#v0-0-0-removed}
107107
### Removed

python/private/print_toolchain_checksums.bzl

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def print_toolchains_checksums(name):
2828
template = """\
2929
cat > "$@" <<'EOF'
3030
#!/bin/bash
31+
set -euo pipefail
3132
3233
set -o errexit -o nounset -o pipefail
3334
@@ -54,35 +55,31 @@ EOF
5455

5556
def _commands_for_version(*, python_version, metadata):
5657
lines = []
57-
lines += [
58-
"cat <<EOB", # end of block
59-
" \"{python_version}\": {{".format(python_version = python_version),
60-
" \"url\": \"{url}\",".format(url = metadata["url"]),
61-
" \"sha256\": {",
62-
]
63-
64-
for platform in metadata["sha256"].keys():
65-
for release_url in get_release_info(platform, python_version)[1]:
66-
# Do lines one by one so that the progress is seen better and use cat for ease of quotation
67-
lines += [
68-
"EOB",
69-
"cat <<EOB",
70-
" \"{platform}\": \"$$({get_sha256})\",".format(
71-
platform = platform,
72-
get_sha256 = "curl --silent --show-error --location --fail {release_url_sha256}".format(
73-
release_url = release_url,
74-
release_url_sha256 = release_url + ".sha256",
75-
),
76-
),
77-
]
78-
58+
first_platform = metadata["sha256"].keys()[0]
59+
root, _, _ = get_release_info(first_platform, python_version)[1][0].rpartition("/")
60+
sha_url = "{}/{}".format(root, "SHA256SUMS")
7961
prefix = metadata["strip_prefix"]
8062
prefix = render.indent(
8163
render.dict(prefix) if type(prefix) == type({}) else repr(prefix),
8264
indent = " " * 8,
8365
).lstrip()
8466

8567
lines += [
68+
"sha256s=$$(curl --silent --show-error --location --fail {})".format(sha_url),
69+
"cat <<EOB",
70+
" \"{python_version}\": {{".format(python_version = python_version),
71+
" \"url\": \"{url}\",".format(url = metadata["url"]),
72+
" \"sha256\": {",
73+
] + [
74+
" \"{platform}\": \"$$({get_sha256})\",".format(
75+
platform = platform,
76+
get_sha256 = "echo \"$$sha256s\" | (grep {} || echo ) | awk '{{print $$1}}'".format(
77+
release_url.rpartition("/")[-1],
78+
),
79+
)
80+
for platform in metadata["sha256"].keys()
81+
for release_url in get_release_info(platform, python_version)[1]
82+
] + [
8683
" },",
8784
" \"strip_prefix\": {strip_prefix},".format(strip_prefix = prefix),
8885
" },",

0 commit comments

Comments
 (0)