Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ A brief description of the categories of changes:
* (rules) `compile_pip_requirements` passes `env` to the `X.update` target (and
not only to the `X_test` target, a bug introduced in
[#1067](https://github.com/bazelbuild/rules_python/pull/1067)).
* (bzlmod) In hybrid bzlmod with WORKSPACE builds,
`python_register_toolchains(register_toolchains=True)` is respected
([#1675](https://github.com/bazelbuild/rules_python/issues/1675)).

### Added
* (py_wheel) Now supports `compress = (True|False)` to allow disabling
Expand Down
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