-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select()
on the Python mode should only see "PY2" or "PY3"
#6501
Comments
Action conflicts will no longer be possible (at least, not via this mechanism) under the new model; see #6583. |
PY2
and null
Python modes can have action conflicts select()
on the Python mode should only see "PY2" or "PY3"
754dddc added a new |
The options fragment gets to decide whether its flags are selectable. This way, selectability can be guarded by an experimental or incompatible change flag, provided that it's declared in the same options fragment as the flag it's guarding. Work toward #6583 and #6501. RELNOTES: None PiperOrigin-RevId: 227040456
The proper way to select on the python version is to have a config_setting depend (via the flag_values attribute) on @bazel_tools//tools/python:python_version. Reading the value of the native flags --python_version, --force_python, or --host_force_python is not guaranteed to give the actual Python version mode, and can lead to action conflicts. This CL makes it an error to select on any of these three native flags when --experimental_better_python_version_mixing is enabled. For --python_version, which is currently experimental, this CL also disallows it even when the experimental flag is not enabled. Work toward #6583 and #6501. RELNOTES: None PiperOrigin-RevId: 227046222
|
Currently the configuration value corresponding to
--force_python
can never transition fromnull
toPY2
, due to a quirk in how the transition logic is implemented. (Basically, it sees thatPY2
is the default value whennull
is specified, and decides that keeping itnull
is good enough.) This means that the same target never appears in both thePY2
andnull
configurations within the same build.This would have changed in my fix for #1446. As it turns out, once you start to have targets built in both modes, you can get action conflicts because the build results are slightly different, even though both modes mean "use the Python 2 interpreter". This is because transitive dependencies can behave differently in
null
mode than inPY2
mode, for instance when you have aselect()
on"force_python"
.The most straightforward immediate solution is to use a separate output path root for
PY2
mode, like we already do with "-py3". This would have performance implications in that there'd now be three different ways you could redundantly rebuild the same targets, instead of just two.A better solution is likely to eliminate
null
as a valid value for this mode entirely...The text was updated successfully, but these errors were encountered: