Skip to content

Commit fef4898

Browse files
committed
handle windows case of using --python_path
1 parent 0d53a81 commit fef4898

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/private/py_executable.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,12 @@ def _create_stage1_bootstrap(
777777

778778
python_binary_actual = venv.interpreter_actual_path if venv else ""
779779

780+
# Runtime may be None on Windows due to the --python_path flag.
781+
if runtime and runtime.supports_build_time_venv:
782+
resolve_python_binary_at_runtime = "0"
783+
else:
784+
resolve_python_binary_at_runtime = "1"
785+
780786
subs = {
781787
"%interpreter_args%": "\n".join([
782788
'"{}"'.format(v)
@@ -786,7 +792,7 @@ def _create_stage1_bootstrap(
786792
"%python_binary%": python_binary_path,
787793
"%python_binary_actual%": python_binary_actual,
788794
"%recreate_venv_at_runtime%": str(int(venv.recreate_venv_at_runtime)) if venv else "0",
789-
"%resolve_python_binary_at_runtime%": "0" if runtime.supports_build_time_venv else "1",
795+
"%resolve_python_binary_at_runtime%": resolve_python_binary_at_runtime,
790796
"%target%": str(ctx.label),
791797
"%venv_rel_site_packages%": venv.venv_site_packages if venv else "",
792798
"%workspace_name%": ctx.workspace_name,

0 commit comments

Comments
 (0)