From 7619039021e13ef11134b3d3aeab4f8e07f12d71 Mon Sep 17 00:00:00 2001 From: Luca Di Grazia Date: Sun, 4 Sep 2022 20:11:56 +0200 Subject: [PATCH] Flip --incompatible_allow_python_version_transitions With this flag enabled by default, the Python version is no longer "sticky" and forced to a fixed value by a command line flag. Instead it adjusts to whatever the `py_binary` or `py_test` declares its version to be. For more information see feature tracking issue #6583 and flag migration tracking issue #7307. Closes #7307. RELNOTES[INC]: (Python rules) The python version now changes to whatever version is specified in a `py_binary` or `py_test`'s `python_version` attribute, instead of being forced to the value set by a command line flag. You can temporarily revert this change with `--incompatible_allow_python_version_transitions=false`. See [#7307](https://github.com/bazelbuild/bazel/issues/7307) for more information. PiperOrigin-RevId: 240227319 --- .../build/lib/rules/python/PythonOptions.java | 36 +++---------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java index 11a4cc0247b..0468469cdd7 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java @@ -105,7 +105,7 @@ public String getTypeDescription() { */ @Option( name = "incompatible_py3_is_default", - defaultValue = "true", + defaultValue = "false", documentationCategory = OptionDocumentationCategory.GENERIC_INPUTS, effectTags = { OptionEffectTag.LOADING_AND_ANALYSIS, @@ -125,7 +125,7 @@ public String getTypeDescription() { @Option( name = "incompatible_py2_outputs_are_suffixed", - defaultValue = "true", + defaultValue = "false", documentationCategory = OptionDocumentationCategory.GENERIC_INPUTS, effectTags = {OptionEffectTag.AFFECTS_OUTPUTS}, metadataTags = { @@ -230,14 +230,11 @@ public String getTypeDescription() { public boolean incompatibleDisallowLegacyPyProvider; @Option( - name = "incompatible_use_python_toolchains", + // TODO(brandjon): Rename to --incompatible_use_python_toolchains when ready to make available + name = "experimental_use_python_toolchains", defaultValue = "false", documentationCategory = OptionDocumentationCategory.GENERIC_INPUTS, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, - metadataTags = { - OptionMetadataTag.INCOMPATIBLE_CHANGE, - OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES - }, help = "If set to true, executable native Python rules will use the Python runtime specified by " + "the Python toolchain, rather than the runtime given by legacy flags like " @@ -254,26 +251,6 @@ public String getTypeDescription() { + "data runfiles of another binary.") public boolean buildTransitiveRunfilesTrees; - @Option( - name = "incompatible_windows_escape_python_args", - defaultValue = "false", - documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS, - effectTags = { - OptionEffectTag.ACTION_COMMAND_LINES, - OptionEffectTag.AFFECTS_OUTPUTS, - }, - metadataTags = { - OptionMetadataTag.INCOMPATIBLE_CHANGE, - OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES - }, - help = - "On Linux/macOS/non-Windows: no-op. On Windows: this flag affects how py_binary and" - + " py_test targets are built: how their launcher escapes command line flags. When" - + " this flag is true, the launcher escapes command line flags using Windows-style" - + " escaping (correct behavior). When the flag is false, the launcher uses Bash-style" - + " escaping (buggy behavior). See https://github.com/bazelbuild/bazel/issues/7958") - public boolean windowsEscapePythonArgs; - @Override public Map getSelectRestrictions() { // TODO(brandjon): Instead of referencing the python_version target, whose path depends on the @@ -392,11 +369,6 @@ public FragmentOptions getHost() { hostPythonOptions.buildPythonZip = buildPythonZip; hostPythonOptions.incompatibleDisallowLegacyPyProvider = incompatibleDisallowLegacyPyProvider; hostPythonOptions.incompatibleUsePythonToolchains = incompatibleUsePythonToolchains; - hostPythonOptions.windowsEscapePythonArgs = windowsEscapePythonArgs; - - // Save host options in case of a further exec->host transition. - hostPythonOptions.hostForcePython = hostForcePython; - return hostPythonOptions; }