From c5f9ac4548d66109f10a2dabe9ebafb73d61c167 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 28 Aug 2024 11:21:21 -0700 Subject: [PATCH] docs: document the exec tools toolchain pieces This makes it easier to know how to manually define `py_exec_tools_toolchain()`. Also doc the `inherit` value for the `pyc_collection` attribute. --- docs/BUILD.bazel | 2 ++ docs/api/rules_python/python/config_settings/index.md | 2 +- python/private/BUILD.bazel | 7 +++++++ python/private/common/py_executable.bzl | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index aa1345aa08..4210876be3 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -90,6 +90,8 @@ sphinx_stardocs( "//python:py_test_bzl", "//python/cc:py_cc_toolchain_info_bzl", "//python/entry_points:py_console_script_binary_bzl", + "//python/private:py_exec_tools_info_bzl", + "//python/private:py_exec_tools_toolchain_bzl", "//python/private/common:py_binary_rule_bazel_bzl", "//python/private/common:py_library_rule_bazel_bzl", "//python/private/common:py_runtime_rule_bzl", diff --git a/docs/api/rules_python/python/config_settings/index.md b/docs/api/rules_python/python/config_settings/index.md index 50647abb8d..2a2b39c53a 100644 --- a/docs/api/rules_python/python/config_settings/index.md +++ b/docs/api/rules_python/python/config_settings/index.md @@ -30,7 +30,7 @@ Values: Determines if Python source files should be compiled at build time. :::{note} -The flag value is overridden by the target level `precompile` attribute, +The flag value is overridden by the target level {attr}`precompile` attribute, except for the case of `force_enabled` and `forced_disabled`. ::: diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 146e934654..488862ff7a 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -203,12 +203,19 @@ bzl_library( ], ) +bzl_library( + name = "py_exec_tools_info_bzl", + srcs = ["py_exec_tools_info.bzl"], +) + bzl_library( name = "py_exec_tools_toolchain_bzl", srcs = ["py_exec_tools_toolchain.bzl"], deps = [ + ":py_exec_tools_info_bzl", ":toolchain_types_bzl", "//python/private/common:providers_bzl", + "@bazel_skylib//lib:paths", "@bazel_skylib//rules:common_settings", ], ) diff --git a/python/private/common/py_executable.bzl b/python/private/common/py_executable.bzl index d1cbea978c..9b8c77cf00 100644 --- a/python/private/common/py_executable.bzl +++ b/python/private/common/py_executable.bzl @@ -99,8 +99,9 @@ Determines whether pyc files from dependencies should be manually included. NOTE: This setting is only useful with {flag}`--precompile_add_to_runfiles=decided_elsewhere`. Valid values are: +* `inherit`: Inherit the value from {flag}`--pyc_collection`. * `include_pyc`: Add pyc files from dependencies in the binary (from - `PyInfo.transitive_pyc_files`. + {obj}`PyInfo.transitive_pyc_files`. * `disabled`: Don't explicitly add pyc files from dependencies. Note that pyc files may still come from dependencies if a target includes them as part of their runfiles (such as when {obj}`--precompile_add_to_runfiles=always`