Skip to content

Commit

Permalink
fix: compatibility with symbolic macros (#488)
Browse files Browse the repository at this point in the history
### Changes are visible to end-users: yes

- Searched for relevant documentation and updated as needed: yes
- Breaking change (forces users to change their own code or config): no
- Suggested release notes appear below: yes

See https://bazel.build/extending/macros#naming, these naming
conventions are violated by this legacy macro (and thus by a symbolic
macro wrapping this legacy macro)

### Test plan

- Covered by existing test cases
  • Loading branch information
dzbarsky authored Jan 8, 2025
1 parent 0b3c298 commit c35d666
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion py/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resolutions = _resolutions

def _py_binary_or_test(name, rule, srcs, main, deps = [], resolutions = {}, **kwargs):
# Compatibility with rules_python, see docs in py_executable.bzl
main_target = "_{}.find_main".format(name)
main_target = "{}.find_main".format(name)
determine_main(
name = main_target,
target_name = name,
Expand Down
4 changes: 2 additions & 2 deletions py/private/py_image_layer.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ awk < $< 'BEGIN {
""" % (mtree_begin_blocks, root, ifs, name)

native.genrule(
name = "_{}_manifests".format(name),
name = "{}_manifests".format(name),
srcs = [name + ".manifest"],
outs = [
"{}.{}.manifest.spec".format(name, group_name)
Expand Down Expand Up @@ -146,7 +146,7 @@ def py_image_layer(name, binary, root = "/", layer_groups = {}, compress = "gzip
# Finally create layers using the tar rule
srcs = []
for group_name in group_names:
tar_target = "_{}_{}".format(name, group_name)
tar_target = "{}_{}".format(name, group_name)
tar(
name = tar_target,
srcs = [binary],
Expand Down
4 changes: 2 additions & 2 deletions py/tests/py_image_layer/asserts.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file")

# buildifier: disable=function-docstring
def assert_tar_listing(name, actual, expected):
actual_listing = "_{}_listing".format(name)
actual_listing = "{}_listing".format(name)
native.genrule(
name = actual_listing,
srcs = actual,
Expand All @@ -18,4 +18,4 @@ def assert_tar_listing(name, actual, expected):
out_file = expected,
testonly = True,
tags = ["skip-on-bazel6"],
)
)

0 comments on commit c35d666

Please sign in to comment.