Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions python/private/py_wheel.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ def _py_wheel_impl(ctx):

for target, filename in ctx.attr.data_files.items():
target_files = target[DefaultInfo].files.to_list()
if len(target_files) != 1:
if len(target_files) != 1 and not filename.endswith("/"):
fail(
"Multi-file target listed in data_files %s",
"Multi-file target listed in data_files %s, this is only supported when specifying a folder path (i.e. a path ending in '/')",
filename,
)

Expand All @@ -519,11 +519,15 @@ def _py_wheel_impl(ctx):
filename,
),
)
other_inputs.extend(target_files)
args.add(
"--data_files",
filename + ";" + target_files[0].path,
)

for file in target_files:
final_filename = filename + file.basename if filename.endswith("/") else filename

other_inputs.extend(target_files)
args.add(
"--data_files",
final_filename + ";" + file.path,
)

ctx.actions.run(
mnemonic = "PyWheel",
Expand Down