@@ -33,9 +33,6 @@ def create_venv_app_files(ctx, deps, venv_dir_map):
3333 {type}`struct` with the following attributes:
3434 * {type}`list[File]` `venv_files` additional files created for
3535 the venv.
36- * {type}`dict[str, File]` `runfiles_symlinks` map intended for
37- the `runfiles.symlinks` argument. A map of main-repo
38- relative paths to File.
3936 """
4037
4138 # maps venv-relative path to the runfiles path it should point to
@@ -49,31 +46,29 @@ def create_venv_app_files(ctx, deps, venv_dir_map):
4946
5047 link_map = build_link_map (ctx , entries )
5148 venv_files = []
52- runfiles_symlinks = {}
5349
5450 for kind , kind_map in link_map .items ():
5551 base = venv_dir_map [kind ]
5652 for venv_path , link_to in kind_map .items ():
5753 bin_venv_path = paths .join (base , venv_path )
58- if is_file (link_to ):
59- symlink_from = "{}/{}" .format (ctx .label .package , bin_venv_path )
60- runfiles_symlinks [symlink_from ] = link_to
6154
62- else :
63- venv_link = ctx .actions .declare_symlink (bin_venv_path )
64- venv_link_rf_path = runfiles_root_path (ctx , venv_link .short_path )
65- rel_path = relative_path (
66- # dirname is necessary because a relative symlink is relative to
67- # the directory the symlink resides within.
68- from_ = paths .dirname (venv_link_rf_path ),
69- to = link_to ,
70- )
71- ctx .actions .symlink (output = venv_link , target_path = rel_path )
72- venv_files .append (venv_link )
55+ # Just for demonstration purposes,
56+ # there is definitely a better thing to do upstream that removeprefix("../")
57+ link_to_path = link_to .short_path .removeprefix ("../" ) if is_file (link_to ) else link_to
58+
59+ venv_link = ctx .actions .declare_symlink (bin_venv_path )
60+ venv_link_rf_path = runfiles_root_path (ctx , venv_link .short_path )
61+ rel_path = relative_path (
62+ # dirname is necessary because a relative symlink is relative to
63+ # the directory the symlink resides within.
64+ from_ = paths .dirname (venv_link_rf_path ),
65+ to = link_to_path ,
66+ )
67+ ctx .actions .symlink (output = venv_link , target_path = rel_path )
68+ venv_files .append (venv_link )
7369
7470 return struct (
7571 venv_files = venv_files ,
76- runfiles_symlinks = runfiles_symlinks ,
7772 )
7873
7974# Visible for testing
0 commit comments