Skip to content

Commit edd6bb6

Browse files
authored
feat: Add feature to expose whether the native rules are used (bazel-contrib#2549)
Internally rules_python decides whether the implementation should use the legacy builtin rules from bazel or not. The rules_python attributes have diverged from the builtin rules e.g. `precompile` and so a consumer of this library that wants to support bazel versions that are still using the legacy builtin rules needs a method to be able to query whether the rules are being used. This change adds a entry to features.bzl to expose whether the legacy builtin rules are being used.
1 parent 1cb4f8f commit edd6bb6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

python/features.bzl

+3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
# limitations under the License.
1414
"""Allows detecting of rules_python features that aren't easily detected."""
1515

16+
load("@rules_python_internal//:rules_python_config.bzl", "config")
17+
1618
# This is a magic string expanded by `git archive`, as set by `.gitattributes`
1719
# See https://git-scm.com/docs/git-archive/2.29.0#Documentation/git-archive.txt-export-subst
1820
_VERSION_PRIVATE = "$Format:%(describe:tags=true)$"
1921

2022
features = struct(
2123
version = _VERSION_PRIVATE if "$Format" not in _VERSION_PRIVATE else "",
2224
precompile = True,
25+
uses_builtin_rules = not config.enable_pystar,
2326
)

0 commit comments

Comments
 (0)