Skip to content

Commit 64f8b6d

Browse files
authored
win: fix proper EXT_BUILD_ROOT in PATH (#1358)
1 parent d1ea8cc commit 64f8b6d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

foreign_cc/private/framework.bzl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,14 @@ def get_env_prelude(ctx, installdir, data_dependencies):
345345
env.update(user_vars)
346346

347347
if cc_toolchain.compiler == "msvc-cl":
348-
if "PATH" in user_vars and "$$EXT_BUILD_ROOT$$" in user_vars["PATH"]:
349-
# Convert any $$EXT_BUILD_ROOT$$ in PATH to /${EXT_BUILD_ROOT/$(printf '\072')/}.
350-
# This is because PATH needs to be in unix format for MSYS2.
351-
user_vars["PATH"] = user_vars["PATH"].replace("$$EXT_BUILD_ROOT$$", "/$${EXT_BUILD_ROOT/$$$(printf '\072')/}")
348+
# Convert any $$EXT_BUILD_ROOT$$ or $EXT_BUILD_ROOT in PATH to
349+
# /${EXT_BUILD_ROOT/$(printf '\072')/}. This is because PATH needs to be in unix
350+
# format for MSYS2.
351+
# Note: $$EXT_BUILD_ROOT becomes $EXT_BUILD_ROOT after
352+
# expand_locations_and_make_variables above.
353+
for build_root in ["$$EXT_BUILD_ROOT$$", "$EXT_BUILD_ROOT"]:
354+
if "PATH" in user_vars and build_root in user_vars["PATH"]:
355+
user_vars["PATH"] = user_vars["PATH"].replace(build_root, "/$${EXT_BUILD_ROOT/$$$(printf '\072')/}")
352356

353357
# If user has defined a PATH variable (e.g. PATH, LD_LIBRARY_PATH, CPATH) prepend it to the existing variable
354358
for user_var in user_vars:

0 commit comments

Comments
 (0)