Skip to content

Commit 44887aa

Browse files
committed
fix: use string replace instead of format for exe_ext substitution
- Change from .format(exe_ext = exe_ext) to .replace("{exe_ext}", exe_ext) - Avoids Python format string errors with literal braces in Starlark code - Fixes 'No replacement found for index 0' error in all platforms
1 parent e137324 commit 44887aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

toolchains/wasi_sdk_toolchain.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ alias(
323323
)
324324
'''
325325

326-
# Format BUILD content with executable extension
327-
build_content = build_content.format(exe_ext = exe_ext)
326+
# Replace exe_ext placeholder with actual extension using string replacement
327+
build_content = build_content.replace("{exe_ext}", exe_ext)
328328
repository_ctx.file("BUILD.bazel", build_content)
329329

330330
# Create cc_toolchain_config.bzl with proper path resolution
@@ -416,8 +416,8 @@ wasm_cc_toolchain_config = rule(
416416
)
417417
'''
418418

419-
# Format cc_config content with executable extension
420-
cc_config_content = cc_config_content.format(exe_ext = exe_ext)
419+
# Replace exe_ext placeholder with actual extension using string replacement
420+
cc_config_content = cc_config_content.replace("{exe_ext}", exe_ext)
421421
repository_ctx.file("cc_toolchain_config.bzl", cc_config_content)
422422

423423
wasi_sdk_repository = repository_rule(

0 commit comments

Comments
 (0)