Skip to content

Commit

Permalink
Revert "Set --incompatible_python_disallow_native_rules"
Browse files Browse the repository at this point in the history
This reverts commit 1348c3b.

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
  bazelbuild/bazel#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:
bazelbuild/bazel#17773 (comment)
  • Loading branch information
aherrmann authored and renovate[bot] committed Nov 1, 2024
1 parent ebf14ef commit de42c0b
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .bazelrc.common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de42c0b

Please sign in to comment.