Skip to content

Commit 0b57e4d

Browse files
committed
finish adding the freethreaded toolchains
1 parent 02e84f7 commit 0b57e4d

File tree

4 files changed

+42
-29
lines changed

4 files changed

+42
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ A brief description of the categories of changes:
3737
by default. Users wishing to keep this argument and to enforce more hermetic
3838
builds can do so by passing the argument in
3939
[`pip.parse#extra_pip_args`](https://rules-python.readthedocs.io/en/latest/api/rules_python/python/extensions/pip.html#pip.parse.extra_pip_args)
40+
* (toolchains) Use the latest indygreg toolchain release [20241016].
41+
42+
[20241016]: https://github.com/indygreg/python-build-standalone/releases/tag/20241016
4043

4144
{#v0-0-0-fixed}
4245
### Fixed
@@ -58,6 +61,7 @@ A brief description of the categories of changes:
5861
and one extra file `requirements_universal.txt` if you prefer a single file.
5962
The `requirements.txt` file may be removed in the future.
6063
* The rules_python version is now reported in `//python/features.bzl#features.version`
64+
* (toolchain) The support for freethreaded Python toolchains is now available.
6165

6266
{#v0-0-0-removed}
6367
### Removed

python/private/hermetic_runtime_repo_setup.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def define_hermetic_runtime_toolchain_impl(
4545
python_version: {type}`str` The Python version, in `major.minor.micro`
4646
format.
4747
python_bin: {type}`str` The path to the Python binary within the
48-
repositoroy.
48+
repository.
4949
coverage_tool: {type}`str` optional target to the coverage tool to
5050
use.
5151
"""

python/private/python_repository.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ def _python_repository_impl(rctx):
6363
platform = rctx.attr.platform
6464
python_version = rctx.attr.python_version
6565
python_version_info = python_version.split(".")
66-
python_short_version = "{0}.{1}".format(*python_version_info)
6766
release_filename = rctx.attr.release_filename
67+
is_freethreaded = "freethreaded" in release_filename
68+
python_short_version = "{0}.{1}".format(*python_version_info) + "t" if is_freethreaded else ""
6869
urls = rctx.attr.urls or [rctx.attr.url]
6970
auth = get_auth(rctx, urls)
7071

python/versions.bzl

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ DEFAULT_RELEASE_BASE_URL = "https://github.com/indygreg/python-build-standalone/
2424

2525
# When updating the versions and releases, run the following command to get
2626
# the hashes:
27-
# bazel run //python/private:print_toolchains_checksums
27+
# bazel run //python/private:print_toolchains_checksums --//python/config_settings:python_version={major}.{minor}.{patch}
2828
#
2929
# Note, to users looking at how to specify their tool versions, coverage_tool version for each
3030
# interpreter can be specified by:
@@ -562,7 +562,7 @@ TOOL_VERSIONS = {
562562
},
563563
"3.13.0": {
564564
"url": {
565-
platform + suffix: "20241008/cpython-{python_version}+20241008-" + build
565+
platform + suffix: "20241016/cpython-{python_version}+20241016-" + build
566566
for platform, opt in {
567567
"aarch64-apple-darwin": "pgo+lto",
568568
"aarch64-unknown-linux-gnu": "lto",
@@ -583,21 +583,20 @@ TOOL_VERSIONS = {
583583
}.items()
584584
},
585585
"sha256": {
586-
"aarch64-apple-darwin": "5d3cb8d7ca4cfbbe7ae1f118f26be112ee417d982fab8c6d85cfd8ccccf70718",
587-
"aarch64-unknown-linux-gnu": "c1142af8f2c85923d2ba8201a35b913bb903a5d15f052c38bbecf2f49e2342dc",
588-
"ppc64le-unknown-linux-gnu": "1be64a330499fed4e1f864b97eef5445b0e4abc0559ae45df3108981800cf998",
589-
"s390x-unknown-linux-gnu": "c0b1cc51426feadaa932fdd9afd9a9af789916e128e48ac8909f9a269bbbd749",
590-
"x86_64-apple-darwin": "b58ca12d9ae14bbd79f9e5cf4b748211ff1953e59abeac63b0f4e8e49845669f",
591-
"x86_64-pc-windows-msvc": "c7651a7a575104f47c808902b020168057f3ad80f277e54cecfaf79a9ff50e22",
592-
"x86_64-unknown-linux-gnu": "455200e1a202e9d9ef4b630c04af701c0a91dcaa6462022efc76893fc762ec95",
593-
# Add freethreaded variants
594-
"aarch64-apple-darwin-freethreaded": "8cc1586c4ee730bb33b7e6d39f1b6388f895075fadb1771e3c27b0561abb9242",
595-
"aarch64-unknown-linux-gnu-freethreaded": "56b11e29095e7c183ae191bf9f5ec4e7a71ac41e9c759786faf16c707b83b6b0",
596-
"ppc64le-unknown-linux-gnu-freethreaded": "abac77abeb3c39c355fbc2cd74216254c46bcb28dda10b525daf821bf1d364dc",
597-
"s390x-unknown-linux-gnu-freethreaded": "9adab574543ab8c5fc0ad9e313050030dbdae85160629b1dcbbc3e9d9515a0da",
598-
"x86_64-apple-darwin-freethreaded": "117528b68096379b1303faee1f4f9e32ef3d255207ec92fb063f1bd0b942549d",
599-
"x86_64-pc-windows-msvc-freethreaded": "fc665561556f4dc843cd3eeba4d482f716aec65d5b89a657316829cfbdc9462a",
600-
"x86_64-unknown-linux-gnu-freethreaded": "00a159a64640ce614bdac064b270a9854d86d40d1d8387a822daf1fe0881e64b",
586+
"aarch64-apple-darwin": "31397953849d275aa2506580f3fa1cb5a85b6a3d392e495f8030e8b6412f5556",
587+
"aarch64-unknown-linux-gnu": "e8378c0162b2e0e4cc1f62b29443a3305d116d09583304dbb0149fecaff6347b",
588+
"ppc64le-unknown-linux-gnu": "fc4b7f27c4e84c78f3c8e6c7f8e4023e4638d11f1b36b6b5ce457b1926cebb53",
589+
"s390x-unknown-linux-gnu": "66b19e6a07717f6cfcd3a8ca953f0a2eaa232291142f3d26a8d17c979ec0f467",
590+
"x86_64-apple-darwin": "cff1b7e7cd26f2d47acac1ad6590e27d29829776f77e8afa067e9419f2f6ce77",
591+
"x86_64-pc-windows-msvc": "b25926e8ce4164cf103bacc4f4d154894ea53e07dd3fdd5ebb16fb1a82a7b1a0",
592+
"x86_64-unknown-linux-gnu": "2c8cb15c6a2caadaa98af51df6fe78a8155b8471cb3dd7b9836038e0d3657fb4",
593+
"aarch64-apple-darwin-freethreaded": "efc2e71c0e05bc5bedb7a846e05f28dd26491b1744ded35ed82f8b49ccfa684b",
594+
"aarch64-unknown-linux-gnu-freethreaded": "59b50df9826475d24bb7eff781fa3949112b5e9c92adb29e96a09cdf1216d5bd",
595+
"ppc64le-unknown-linux-gnu-freethreaded": "1217efa5f4ce67fcc9f7eb64165b1bd0912b2a21bc25c1a7e2cb174a21a5df7e",
596+
"s390x-unknown-linux-gnu-freethreaded": "6c3e1e4f19d2b018b65a7e3ef4cd4225c5b9adfbc490218628466e636d5c4b8c",
597+
"x86_64-apple-darwin-freethreaded": "2e07dfea62fe2215738551a179c87dbed1cc79d1b3654f4d7559889a6d5ce4eb",
598+
"x86_64-pc-windows-msvc-freethreaded": "bfd89f9acf866463bc4baf01733da5e767d13f5d0112175a4f57ba91f1541310",
599+
"x86_64-unknown-linux-gnu-freethreaded": "a73adeda301ad843cce05f31a2d3e76222b656984535a7b87696a24a098b216c",
601600
},
602601
"strip_prefix": "python",
603602
},
@@ -807,15 +806,13 @@ def print_toolchains_checksums(name):
807806
Args:
808807
name: {type}`str`: the name of the runnable target.
809808
"""
810-
commands = []
809+
all_commands = []
810+
by_version = {}
811811
for python_version in TOOL_VERSIONS.keys():
812-
commands.append(_commands_for_version(python_version))
812+
by_version[python_version] = _commands_for_version(python_version)
813+
all_commands.append(_commands_for_version(python_version))
813814

814-
native.genrule(
815-
name = name,
816-
srcs = [],
817-
outs = ["print_toolchains_checksums.sh"],
818-
cmd = """\
815+
template = """\
819816
cat > "$@" <<'EOF'
820817
#!/bin/bash
821818
@@ -825,9 +822,20 @@ echo "Fetching hashes..."
825822
826823
{commands}
827824
EOF
828-
""".format(
829-
commands = "\n".join(commands),
830-
),
825+
"""
826+
827+
native.genrule(
828+
name = name,
829+
srcs = [],
830+
outs = ["print_toolchains_checksums.sh"],
831+
cmd = select({
832+
"//python/config_settings:is_python_{}".format(version): template.format(
833+
commands = commands,
834+
)
835+
for version, commands in by_version.items()
836+
} | {
837+
"//conditions:default": template.format(commands = "\n".join(all_commands)),
838+
}),
831839
executable = True,
832840
)
833841

0 commit comments

Comments
 (0)