Skip to content

Commit e58f396

Browse files
shayanhoshyariShayan Hoshyari
andauthored
fix(venv): Fix all .so files missing when py_binary lives at //:BUILD (#3474)
When `.label.package` was "" (empty string), doing `"{}/{}".format(ctx.label.package, bin_venv_path)` created an absolute path, which caused files to be ignored later, as they no longer looked to be part of the correct prefix. An empty package name occurs when the target is in `//:BUILD` with venv on. To fix, use skylib's `paths` instead, which handles it correctly and won't add the `/` prefix. Fixes #3470 Co-authored-by: Shayan Hoshyari <[email protected]>
1 parent 9a20fc2 commit e58f396

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/private/venv_runfiles.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def create_venv_app_files(ctx, deps, venv_dir_map):
6464
for venv_path, link_to in kind_map.items():
6565
bin_venv_path = paths.join(base, venv_path)
6666
if is_file(link_to):
67-
symlink_from = "{}/{}".format(ctx.label.package, bin_venv_path)
67+
# use paths.join to handle ctx.label.package = ""
68+
symlink_from = paths.join(ctx.label.package, bin_venv_path)
6869
runfiles_symlinks[symlink_from] = link_to
6970
else:
7071
venv_link = ctx.actions.declare_symlink(bin_venv_path)

0 commit comments

Comments
 (0)