-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
There've been multiple reports of action conflicts when --incompatible_allow_python_version_transitions is enabled. Here's a minimal repro:
cc_binary(
name = "foo",
srcs = ["foo.cc"],
)
py_binary(
name = "bar",
srcs = ["bar.py"],
data = [":foo"],
)bazel build --nobuild :foo :bar --incompatible_allow_python_version_transitions
Note that :foo is built in two configurations: the top-level configuration, and a config transitioned by the py_binary rule. The transition serves two purposes:
-
It changes the Python version if necessary (not the case here).
-
It changes the value of the physical
--force_pythonflag (above it'snullsince it's absent) to be consistent with the Python version, so thatselect()s on"force_python"will work. This is done to improve backward compatibility, but once code is migrated for--incompatible_remove_old_python_version, selecting on"force_python"is actually prohibited anyway and this is moot.
The logic for whether or not the transition occurs is here. If I prevent the transition from happening, the action conflict goes away. This can be done by passing either an explicit (but semantically redundant) --force_python=PY2 flag, or the --incompatible_remove_old_python_version_api flag.
The question is what are the exact conflicting actions, and why did the two nearly identical configurations produce different results? It can't be due to hidden select()s on "force_python" (via implicit dependencies), because they would be errors under --incompatible_remove_old_python_version_api.