Skip to content

Commit c9f1b27

Browse files
committed
Allow files or groups of files to be installed to directories
1 parent f61b4cf commit c9f1b27

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

python/private/py_wheel.bzl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,9 @@ def _py_wheel_impl(ctx):
505505

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

@@ -520,13 +520,14 @@ def _py_wheel_impl(ctx):
520520
),
521521
)
522522

523-
final_filename = filename + target_files[0].basename if filename.endswith("/") else filename
523+
for file in target_files:
524+
final_filename = filename + file.basename if filename.endswith("/") else filename
524525

525-
other_inputs.extend(target_files)
526-
args.add(
527-
"--data_files",
528-
final_filename + ";" + target_files[0].path,
529-
)
526+
other_inputs.extend(target_files)
527+
args.add(
528+
"--data_files",
529+
final_filename + ";" + file.path,
530+
)
530531

531532
ctx.actions.run(
532533
mnemonic = "PyWheel",

0 commit comments

Comments
 (0)