Skip to content

Commit a0cb8ed

Browse files
committed
move platform overrides first in platform ordering
1 parent b38053f commit a0cb8ed

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ dev_python.override(
126126
)
127127

128128
# Necessary so single_version_platform_override with a new version works
129-
dev_python.toolchain(python_version = "3.13")
129+
##dev_python.toolchain(python_version = "3.13")
130130

131131
# For testing an arbitrary runtime triggered by a custom flag.
132132
# See //tests/toolchains:custom_platform_toolchain_test

internal_dev_setup.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def rules_python_internal_setup():
4242
toolchain_platform_keys = {},
4343
toolchain_python_versions = {},
4444
toolchain_set_python_version_constraints = {},
45-
base_toolchain_repo_names = [],
45+
host_compatible_repo_names = [],
4646
)
4747

4848
runtime_env_repo(name = "rules_python_runtime_env_tc_info")

python/private/py_repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def py_repositories():
4747
toolchain_platform_keys = {},
4848
toolchain_python_versions = {},
4949
toolchain_set_python_version_constraints = {},
50-
base_toolchain_repo_names = [],
50+
host_compatible_repo_names = [],
5151
)
5252
http_archive(
5353
name = "bazel_skylib",

python/private/python.bzl

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,6 @@ def _python_impl(module_ctx):
340340

341341
host_platforms = {}
342342
for repo_name, (platform_name, platform_info) in register_result.impl_repos.items():
343-
if "3.13.1" in full_python_version:
344-
print("registered:", repo_name)
345343
toolchain_impls.append(struct(
346344
# str: The base name to use for the toolchain() target
347345
name = repo_name,
@@ -713,12 +711,23 @@ def _process_single_version_platform_overrides(*, tag, _fail = fail, default):
713711
if not arch:
714712
arch = "UNKNOWN_CUSTOM_ARCH"
715713

716-
default["platforms"][tag.platform] = platform_info(
717-
compatible_with = target_compatible_with,
718-
target_settings = tag.target_settings,
719-
os_name = os_name,
720-
arch = arch,
721-
)
714+
# Move the override earlier in the ordering -- the platform key ordering
715+
# becomes the toolchain ordering within the version.
716+
override_first = {
717+
tag.platform: platform_info(
718+
compatible_with = target_compatible_with,
719+
target_settings = tag.target_settings,
720+
os_name = os_name,
721+
arch = arch,
722+
),
723+
}
724+
for key, value in default["platforms"].items():
725+
# Don't replace our override with the old value
726+
if key in override_first:
727+
continue
728+
override_first[key] = value
729+
730+
default["platforms"] = override_first
722731

723732
def _process_global_overrides(*, tag, default, _fail = fail):
724733
if tag.available_python_versions:

python/private/pythons_hub.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ PYTHON_VERSIONS = {python_versions}
9696
def _hub_repo_impl(rctx):
9797
# Create the various toolchain definitions and
9898
# write them to the BUILD file.
99-
content = _hub_build_file_content(rctx)
100-
print(content, "===")
99+
##content = _hub_build_file_content(rctx)
100+
##print(content, "===")
101101
rctx.file(
102102
"BUILD.bazel",
103103
_hub_build_file_content(rctx),

0 commit comments

Comments
 (0)