Skip to content

Commit b11f077

Browse files
authored
fix: define rules_python_internal earlier so Bazel 9 doesn't try to use PyInfo et al builtins (bazel-contrib#2485)
For Bazel 9 workspace builds, if `@rules_python_internal` isn't defined early enough, an earlier version of `@rules_python` gets defined and the logic to not use the builtin PyInfo et al symbols doesn't occur. Since Bazel 9 doesn't have these builtins, an error occurs. This seems to only happen if the main module is rules_python. The example workspaces don't see to have an issue. I'm not sure why, but it seems similar to the behavior where autoloading is disabled for specific repos, rules_python among them. To fix, move the `@rules_python_internal` repo definition to be earlier in the WORKSPACE processing. With that repo defined, the conditional logic takes place, and things seem to be happy.
1 parent 7fd5191 commit b11f077

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

internal_dev_deps.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive", _http_file = "http_file")
1818
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
19+
load("//python/private:internal_config_repo.bzl", "internal_config_repo") # buildifier: disable=bzl-visibility
1920

2021
def http_archive(name, **kwargs):
2122
maybe(
@@ -39,6 +40,7 @@ def rules_python_internal_deps():
3940
For dependencies needed by *users* of rules_python, see
4041
python/private/py_repositories.bzl.
4142
"""
43+
internal_config_repo(name = "rules_python_internal")
4244

4345
http_archive(
4446
name = "bazel_skylib",

internal_dev_setup.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_
2525
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
2626
load("//:version.bzl", "SUPPORTED_BAZEL_VERSIONS")
2727
load("//python:versions.bzl", "MINOR_MAPPING", "TOOL_VERSIONS")
28-
load("//python/private:internal_config_repo.bzl", "internal_config_repo") # buildifier: disable=bzl-visibility
2928
load("//python/private:pythons_hub.bzl", "hub_repo") # buildifier: disable=bzl-visibility
3029
load("//python/private/pypi:deps.bzl", "pypi_deps") # buildifier: disable=bzl-visibility
3130

3231
def rules_python_internal_setup():
3332
"""Setup for development and testing of rules_python itself."""
3433

35-
internal_config_repo(name = "rules_python_internal")
3634
hub_repo(
3735
name = "pythons_hub",
3836
minor_mapping = MINOR_MAPPING,

0 commit comments

Comments
 (0)