Skip to content

Commit

Permalink
wip: bzlmod workspace interop
Browse files Browse the repository at this point in the history
  • Loading branch information
rickeylev committed Oct 11, 2024
1 parent 83eb5e8 commit 0272f6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion python/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ bzl_library(
deps = [
":auth_bzl",
":bazel_tools_bzl",
":bzlmod_enabled_bzl",
":coverage_deps_bzl",
":full_version_bzl",
":internal_config_repo_bzl",
Expand Down
6 changes: 5 additions & 1 deletion python/private/python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ def _python_impl(module_ctx):
kwargs.update(py.config.kwargs.get(toolchain_info.python_version, {}))
kwargs.update(py.config.kwargs.get(full_python_version, {}))
kwargs.update(py.config.default)
python_register_toolchains(name = toolchain_info.name, **kwargs)
python_register_toolchains(
name = toolchain_info.name,
_internal_bzlmod_toolchain_call = True,
**kwargs
)

# Create the pythons_hub repo for the interpreter meta data and the
# the various toolchains.
Expand Down
8 changes: 3 additions & 5 deletions python/private/python_register_toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ load(
"TOOL_VERSIONS",
"get_release_info",
)
load(":bzlmod_enabled.bzl", "BZLMOD_ENABLED")
load(":coverage_deps.bzl", "coverage_dep")
load(":full_version.bzl", "full_version")
load(":python_repository.bzl", "python_repository")
Expand Down Expand Up @@ -75,9 +74,8 @@ def python_register_toolchains(
version.
**kwargs: passed to each {obj}`python_repository` call.
"""

if BZLMOD_ENABLED:
# you cannot used native.register_toolchains when using bzlmod.
bzlmod_toolchain_call = kwargs.pop("_internal_bzlmod_toolchain_call", False)
if bzlmod_toolchain_call:
register_toolchains = False

base_url = kwargs.pop("base_url", DEFAULT_RELEASE_BASE_URL)
Expand Down Expand Up @@ -169,7 +167,7 @@ def python_register_toolchains(
)

# in bzlmod we write out our own toolchain repos
if BZLMOD_ENABLED:
if bzlmod_toolchain_call:
return

toolchains_repo(
Expand Down

0 comments on commit 0272f6c

Please sign in to comment.