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 d3ff7a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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
7 changes: 3 additions & 4 deletions python/private/python_register_toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,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 +168,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 d3ff7a6

Please sign in to comment.