Skip to content

Commit

Permalink
Include symlinks and root_symlinks in Python ZIPs
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Mar 31, 2023
1 parent e97f62d commit 2d71135
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ def _create_windows_exe_launcher(
use_default_shell_env = True,
)

def _map_zip_runfiles_symlink(symlink_entry):
return "{}={}".format(symlink_entry.path, symlink_entry.target_file.path)

def _create_zip_file(ctx, *, output, original_nonzip_executable, executable_for_zip_file, runfiles):
workspace_name = ctx.workspace_name
legacy_external_runfiles = _py_builtins.get_legacy_external_runfiles(ctx)
Expand Down Expand Up @@ -370,6 +373,9 @@ def _create_zip_file(ctx, *, output, original_nonzip_executable, executable_for_
return None

manifest.add_all(runfiles.files, map_each = map_zip_runfiles, allow_closure = True)
manifest.add_all(runfiles.symlinks, map_each = _map_zip_runfiles_symlink)
manifest.add_all(runfiles.root_symlinks, map_each = _map_zip_runfiles_symlink)

inputs = [executable_for_zip_file]
for artifact in runfiles.files.to_list():
# Don't include the original executable because it isn't used by the
Expand Down

0 comments on commit 2d71135

Please sign in to comment.