From de42c0bd1aa995fbf7fa27a0304ad42d875b1f1d Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Fri, 1 Nov 2024 08:57:33 +0100 Subject: [PATCH] Revert "Set --incompatible_python_disallow_native_rules" This reverts commit 1348c3bf5ce4e1d1978e22af367ab2dd5a0f85f4. The --incompatible_python_disallow_native_rules flag fails in WORKSPACE mode due to incompatible use in the builtin `@bazel_tools` repo. See https://github.com/aherrmann/rules_zig/actions/runs/11626106944/job/32377199087?pr=380#step:3:762 ``` (07:45:07) ERROR: /home/runner/.cache/bazel-repo/bazel/_bazel_runner/e97befc866f153aa83e528704066dbd2/external/bazel_tools/tools/python/BUILD:110:31: in py_runtime rule @@bazel_tools//tools/python:_autodetecting_py3_runtime: Traceback (most recent call last): File "/virtual_builtins_bzl/common/python/py_runtime_rule.bzl", line 24, column 25, in _py_runtime_impl File "/virtual_builtins_bzl/common/python/common.bzl", line 520, column 13, in check_native_allowed Error in fail: @bazel_tools//tools/python:_autodetecting_py3_runtime not allowed to use native.py_runtime Generated by: define_autodetecting_toolchain(name=autodetecting_toolchain) in tools/python/BUILD:110:31 Allowlist: no allowlist specified; all disallowed; specify one with --python_native_rules_allowlist Migrate to using @rules_python, see https://github.com/bazelbuild/bazel/issues/17773 FIXCMD: add_python_loads --target=@bazel_tools//tools/python:_autodetecting_py3_runtime --rule=py_runtime --generator_name=autodetecting_toolchain --location=tools/python/BUILD:110:31 ``` The `@bazel_tools` repo cannot be modified, so the `FIXCMD` solution does not apply. The allowlist flag expects a package_group, but `@bazel_tools` has no pre-defined package_group, and a user defined `package_group` cannot refer to other workspaces because elements of the `packages` attribute must start with `//`. See the discussion around the following comment for other solutions: https://github.com/bazelbuild/bazel/issues/17773#issuecomment-2336533394 --- .bazelrc.common | 3 --- 1 file changed, 3 deletions(-) diff --git a/.bazelrc.common b/.bazelrc.common index 02279583..4dcaf55e 100644 --- a/.bazelrc.common +++ b/.bazelrc.common @@ -22,9 +22,6 @@ build --sandbox_default_allow_network=false # docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles build --nolegacy_external_runfiles -# docs: https://bazel.build/reference/command-line-reference#flag--incompatible_python_disallow_native_rules -build --incompatible_python_disallow_native_rules - # docs: https://bazel.build/reference/command-line-reference#flag--test_output test --test_output=errors # docs: https://bazel.build/reference/command-line-reference#flag--test_verbose_timeout_warnings