Skip to content

Commit 0fdf1b2

Browse files
committed
fixup function changes
1 parent 153c26e commit 0fdf1b2

File tree

3 files changed

+20
-30
lines changed

3 files changed

+20
-30
lines changed

python/private/py_library.bzl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,9 @@ load(
2525
"REQUIRED_EXEC_GROUP_BUILDERS",
2626
)
2727
load(":builders.bzl", "builders")
28-
load(
29-
":common.bzl",
30-
"collect_imports",
31-
"collect_runfiles",
32-
"create_instrumented_files_info",
33-
"create_output_group_info",
34-
"create_py_info",
35-
"filter_to_py_srcs",
36-
)
28+
load(":common.bzl", "collect_cc_info", "collect_imports", "collect_runfiles", "create_instrumented_files_info", "create_library_semantics_struct", "create_output_group_info", "create_py_info", "filter_to_py_srcs", "get_imports")
3729
load(":flags.bzl", "AddSrcsToRunfilesFlag", "PrecompileFlag")
30+
load(":precompile.bzl", "maybe_precompile")
3831
load(":py_cc_link_params_info.bzl", "PyCcLinkParamsInfo")
3932
load(":py_internal.bzl", "py_internal")
4033
load(":rule_builders.bzl", "ruleb")
@@ -57,6 +50,16 @@ LIBRARY_ATTRS = dicts.add(
5750
},
5851
)
5952

53+
def _py_library_impl_with_semantics(ctx):
54+
return py_library_impl(
55+
ctx,
56+
semantics = create_library_semantics_struct(
57+
get_imports = get_imports,
58+
maybe_precompile = maybe_precompile,
59+
get_cc_info_for_library = collect_cc_info,
60+
),
61+
)
62+
6063
def py_library_impl(ctx, *, semantics):
6164
"""Abstract implementation of py_library rule.
6265
@@ -156,8 +159,9 @@ def create_py_library_rule_builder():
156159
for creating a `py_library` rule.
157160
"""
158161
builder = ruleb.Rule(
162+
implementation = _py_library_impl_with_semantics,
159163
doc = _DEFAULT_PY_LIBRARY_DOC,
160-
exec_groups = REQUIRED_EXEC_GROUP_BUILDERS,
164+
exec_groups = dict(REQUIRED_EXEC_GROUP_BUILDERS),
161165
attrs = LIBRARY_ATTRS,
162166
fragments = ["py"],
163167
toolchains = [

python/private/py_library_rule.bzl

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@
1313
# limitations under the License.
1414
"""Implementation of py_library rule."""
1515

16-
load(":common.bzl", "collect_cc_info", "create_library_semantics_struct", "get_imports")
17-
load(":precompile.bzl", "maybe_precompile")
18-
load(":py_library.bzl", "create_py_library_rule_builder", "py_library_impl")
16+
load(":py_library.bzl", "create_py_library_rule_builder")
1917

20-
def _py_library_impl_with_semantics(ctx):
21-
return py_library_impl(
22-
ctx,
23-
semantics = create_library_semantics_struct(
24-
get_imports = get_imports,
25-
maybe_precompile = maybe_precompile,
26-
get_cc_info_for_library = collect_cc_info,
27-
),
28-
)
29-
30-
py_library = create_py_library_rule_builder(
31-
implementation = _py_library_impl_with_semantics,
32-
).build()
18+
py_library = create_py_library_rule_builder().build()

tests/support/sh_py_run_test.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ without the overhead of a bazel-in-bazel integration test.
2020
load("@rules_shell//shell:sh_test.bzl", "sh_test")
2121
load("//python/private:attr_builders.bzl", "attrb") # buildifier: disable=bzl-visibility
2222
load("//python/private:py_binary_macro.bzl", "py_binary_macro") # buildifier: disable=bzl-visibility
23-
load("//python/private:py_binary_rule.bzl", "create_binary_rule_builder") # buildifier: disable=bzl-visibility
23+
load("//python/private:py_binary_rule.bzl", "create_py_binary_rule_builder") # buildifier: disable=bzl-visibility
2424
load("//python/private:py_test_macro.bzl", "py_test_macro") # buildifier: disable=bzl-visibility
25-
load("//python/private:py_test_rule.bzl", "create_test_rule_builder") # buildifier: disable=bzl-visibility
25+
load("//python/private:py_test_rule.bzl", "create_py_test_rule_builder") # buildifier: disable=bzl-visibility
2626
load("//python/private:toolchain_types.bzl", "TARGET_TOOLCHAIN_TYPE") # buildifier: disable=bzl-visibility
2727
load("//tests/support:support.bzl", "VISIBLE_FOR_TESTING")
2828

@@ -79,9 +79,9 @@ def _create_reconfig_rule(builder):
7979
builder.cfg.update_outputs(_RECONFIG_OUTPUTS)
8080
return builder.build()
8181

82-
_py_reconfig_binary = _create_reconfig_rule(create_binary_rule_builder())
82+
_py_reconfig_binary = _create_reconfig_rule(create_py_binary_rule_builder())
8383

84-
_py_reconfig_test = _create_reconfig_rule(create_test_rule_builder())
84+
_py_reconfig_test = _create_reconfig_rule(create_py_test_rule_builder())
8585

8686
def py_reconfig_test(**kwargs):
8787
"""Create a py_test with customized build settings for testing.

0 commit comments

Comments
 (0)