Skip to content

Commit d7e1759

Browse files
committed
More buildifier fixes.
1 parent 6679e5d commit d7e1759

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

python/private/flags.bzl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,22 @@ _POSSIBLY_NATIVE_FLAGS = {
4545
"use_toolchains": (lambda ctx: ctx.fragments.py.use_toolchains, "native"),
4646
}
4747

48-
# API for reading flags that might be defined in Starlark or in Bazel. All code
49-
# that reads Python flags should read them through this function.
50-
#
51-
# This properly routes to the right flag source depending on Bazel version and
52-
# the --incompatible* flags that disable native flag references.
5348
def read_possibly_native_flag(ctx, flag_name):
49+
"""
50+
Canonical API for reading a Python build flag.
51+
52+
Flags might be defined in Starlark or native-Bazel. This function reasd flags
53+
from tbe correct source based on supporting Bazel version and --incompatible*
54+
flags that disable native references.
55+
56+
Args:
57+
ctx: Rule's configuration context.
58+
flag_name: Name of the flag to read, without preceding "--".
59+
60+
Returns:
61+
The flag's value.
62+
"""
63+
5464
# Bazel 9.0+ can disable these fragments with --incompatible_remove_ctx_py_fragment and
5565
# --incompatible_remove_ctx_bazel_py_fragment. Disabling them means bazel expects
5666
# Python to read Starlark flags.

python/private/py_runtime_pair_rule.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
1818
load("//python:py_runtime_info.bzl", "PyRuntimeInfo")
1919
load(":common_labels.bzl", "labels")
20+
load(":flags.bzl", "read_possibly_native_flag")
2021
load(":reexports.bzl", "BuiltinPyRuntimeInfo")
2122
load(":util.bzl", "IS_BAZEL_7_OR_HIGHER")
22-
load(":flags.bzl", "read_possibly_native_flag")
2323

2424
def _py_runtime_pair_impl(ctx):
2525
if ctx.attr.py2_runtime != None:

0 commit comments

Comments
 (0)