@@ -144,10 +144,9 @@ def search_path(name):
144144def find_python_binary (runfiles_root ):
145145 """Finds the real Python binary if it's not a normal absolute path."""
146146 if PYTHON_BINARY :
147- bin_path = find_binary (runfiles_root , PYTHON_BINARY )
147+ return find_binary (runfiles_root , PYTHON_BINARY )
148148 else :
149- bin_path = find_binary (runfiles_root , PYTHON_BINARY_ACTUAL )
150- return bin_path
149+ return find_binary (runfiles_root , PYTHON_BINARY_ACTUAL )
151150
152151
153152def print_verbose (* args , mapping = None , values = None ):
@@ -353,13 +352,16 @@ print(site.getsitepackages(["{venv_src}"])[-1])
353352 target = join (python_home , f )
354353 _symlink_exist_ok (from_ = venv_path , to = target )
355354
356- # Re-add all the entries under bin/, which includes supporting
357- # .dll files when under windows.
358355 runfiles_venv_bin = join (runfiles_venv , BIN_DIR_NAME )
359- for f_basename in os .listdir (runfiles_venv_bin ):
360- venv_path = join (venv , BIN_DIR_NAME , f_basename )
361- target = join (runfiles_venv_bin , f_basename )
362- _symlink_exist_ok (from_ = venv_path , to = target )
356+ # The runfiles bin directory may not exist if
357+ # supports_build_time_venv=False and the interpreter is resolved at runtime.
358+ if os .path .exists (runfiles_venv_bin ):
359+ # Re-add all the entries under bin/, which includes supporting
360+ # .dll files when under windows.
361+ for f_basename in os .listdir (runfiles_venv_bin ):
362+ venv_path = join (venv , BIN_DIR_NAME , f_basename )
363+ target = join (runfiles_venv_bin , f_basename )
364+ _symlink_exist_ok (from_ = venv_path , to = target )
363365
364366 _symlink_exist_ok (from_ = join (venv , "lib" ), to = join (runfiles_venv , "lib" ))
365367 _symlink_exist_ok (from_ = venv_site_packages , to = runfiles_venv_site_packages )
0 commit comments