45 lines
1.8 KiB
Diff
45 lines
1.8 KiB
Diff
diff --git a/python/private/python_register_toolchains.bzl b/python/private/python_register_toolchains.bzl
|
|
index 9e75c419..ba6d8f7a 100644
|
|
--- a/python/private/python_register_toolchains.bzl
|
|
+++ b/python/private/python_register_toolchains.bzl
|
|
@@ -94,6 +94,7 @@ def python_register_toolchains(
|
|
minor_mapping = minor_mapping or MINOR_MAPPING
|
|
|
|
python_version = full_version(version = python_version, minor_mapping = minor_mapping)
|
|
+ python_version_kind = kwargs.pop("python_version_kind", "")
|
|
|
|
toolchain_repo_name = "{name}_toolchains".format(name = name)
|
|
|
|
@@ -174,6 +175,7 @@ def python_register_toolchains(
|
|
name = name + "_host",
|
|
platforms = loaded_platforms,
|
|
python_version = python_version,
|
|
+ python_version_kind = python_version_kind,
|
|
)
|
|
|
|
toolchains_repo(
|
|
diff --git a/python/private/toolchains_repo.bzl b/python/private/toolchains_repo.bzl
|
|
index f7ff19c3..458f2885 100644
|
|
--- a/python/private/toolchains_repo.bzl
|
|
+++ b/python/private/toolchains_repo.bzl
|
|
@@ -445,6 +445,10 @@ Full python version, Major.Minor.Micro.
|
|
Only set in workspace calls.
|
|
""",
|
|
),
|
|
+ "python_version_kind": attr.string(
|
|
+ doc = "Python version kind, e.g. ft (free-threaded)",
|
|
+ default = ""
|
|
+ ),
|
|
"python_versions": attr.string_dict(
|
|
doc = """
|
|
If set, the Python version for the corresponding selected platform. Values in
|
|
@@ -603,6 +607,9 @@ def _get_host_impl_repo_name(*, rctx, logger, python_version, os_name, cpu_name,
|
|
else:
|
|
candidates = [preference]
|
|
|
|
+ if rctx.attr.python_version_kind == "ft":
|
|
+ candidates = [c for c in candidates if c[0].endswith("freethreaded")]
|
|
+
|
|
if candidates:
|
|
platform_name, meta = candidates[0]
|
|
suffix = meta.impl_repo_name
|