1414 "VenvSymlinkEntry" ,
1515 "VenvSymlinkKind" ,
1616)
17+ load (":py_internal.bzl" , "py_internal" )
1718
1819def create_venv_app_files (ctx , deps , venv_dir_map ):
1920 """Creates the tree of app-specific files for a venv for a binary.
@@ -44,16 +45,16 @@ def create_venv_app_files(ctx, deps, venv_dir_map):
4445
4546 link_map = build_link_map (ctx , entries )
4647 venv_files = []
48+ runfiles_symlinks = {}
49+
4750 for kind , kind_map in link_map .items ():
4851 base = venv_dir_map [kind ]
4952 for venv_path , link_to in kind_map .items ():
5053 bin_venv_path = paths .join (base , venv_path )
5154 if is_file (link_to ):
52- if link_to .is_directory :
53- venv_link = ctx .actions .declare_directory (bin_venv_path )
54- else :
55- venv_link = ctx .actions .declare_file (bin_venv_path )
56- ctx .actions .symlink (output = venv_link , target_file = link_to )
55+ symlink_from = "{}/{}" .format (ctx .label .package , bin_venv_path )
56+ runfiles_symlinks [symlink_from ] = link_to
57+
5758 else :
5859 venv_link = ctx .actions .declare_symlink (bin_venv_path )
5960 venv_link_rf_path = runfiles_root_path (ctx , venv_link .short_path )
@@ -64,9 +65,12 @@ def create_venv_app_files(ctx, deps, venv_dir_map):
6465 to = link_to ,
6566 )
6667 ctx .actions .symlink (output = venv_link , target_path = rel_path )
67- venv_files .append (venv_link )
68+ venv_files .append (venv_link )
6869
69- return venv_files
70+ return struct (
71+ venv_files = venv_files ,
72+ runfiles_symlinks = runfiles_symlinks ,
73+ )
7074
7175# Visible for testing
7276def build_link_map (ctx , entries ):
0 commit comments