Skip to content

Commit d5be866

Browse files
committed
Allow files in wheels to be installed to directories
When specifying `data_files` in `py_wheel`, allow just the directory to be specified (with a trailing slash), in which case it will use the file's name. This avoids duplicating (potentially platform-specific) names.
1 parent 1e17486 commit d5be866

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/private/py_wheel.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,13 @@ def _py_wheel_impl(ctx):
516516
filename,
517517
),
518518
)
519+
520+
final_filename = filename + target_files[0].basename if filename.endswith("/") else filename
521+
519522
other_inputs.extend(target_files)
520523
args.add(
521524
"--data_files",
522-
filename + ";" + target_files[0].path,
525+
final_filename + ";" + target_files[0].path,
523526
)
524527

525528
ctx.actions.run(

0 commit comments

Comments
 (0)