@@ -543,6 +543,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
543543 VenvsUseDeclareSymlinkFlag .get_value (ctx ) == VenvsUseDeclareSymlinkFlag .YES
544544 )
545545 recreate_venv_at_runtime = False
546+ bin_dir = "{}/bin" .format (venv )
546547
547548 if not venvs_use_declare_symlink_enabled or not runtime .supports_build_time_venv :
548549 recreate_venv_at_runtime = True
@@ -556,7 +557,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
556557 # When the venv symlinks are disabled, the $venv/bin/python3 file isn't
557558 # needed or used at runtime. However, the zip code uses the interpreter
558559 # File object to figure out some paths.
559- interpreter = ctx .actions .declare_file ("{}/bin/ {}" .format (venv , py_exe_basename ))
560+ interpreter = ctx .actions .declare_file ("{}/{}" .format (bin_dir , py_exe_basename ))
560561 ctx .actions .write (interpreter , "actual:{}" .format (interpreter_actual_path ))
561562
562563 elif runtime .interpreter :
@@ -568,7 +569,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
568569 # declare_symlink() is required to ensure that the resulting file
569570 # in runfiles is always a symlink. An RBE implementation, for example,
570571 # may choose to write what symlink() points to instead.
571- interpreter = ctx .actions .declare_symlink ("{}/bin/ {}" .format (venv , py_exe_basename ))
572+ interpreter = ctx .actions .declare_symlink ("{}/{}" .format (bin_dir , py_exe_basename ))
572573
573574 interpreter_actual_path = runfiles_root_path (ctx , runtime .interpreter .short_path )
574575 rel_path = relative_path (
@@ -581,7 +582,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
581582 ctx .actions .symlink (output = interpreter , target_path = rel_path )
582583 else :
583584 py_exe_basename = paths .basename (runtime .interpreter_path )
584- interpreter = ctx .actions .declare_symlink ("{}/bin/ {}" .format (venv , py_exe_basename ))
585+ interpreter = ctx .actions .declare_symlink ("{}/{}" .format (bin_dir , py_exe_basename ))
585586 ctx .actions .symlink (output = interpreter , target_path = runtime .interpreter_path )
586587 interpreter_actual_path = runtime .interpreter_path
587588
@@ -619,7 +620,6 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
619620 computed_substitutions = computed_subs ,
620621 )
621622
622- bin_dir = "bin"
623623 venv_dir_map = {
624624 VenvSymlinkKind .BIN : bin_dir ,
625625 VenvSymlinkKind .LIB : site_packages ,
0 commit comments