mdbook preprocessor written as a `py_binary` is silently skipped
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- build-system
调研方向
从 @rules_rust_mdbook//:defs.bzl 加载的 mdbook 规则开始,跟踪 plugins 属性如何处理 py_binary 目标及其可执行文件。使用提供的 MODULE.bazel、BUILD.bazel、book.toml 和示例文件重现问题;当预处理器将 {{secret}} 展开为 42,且构建输出反映这一展开时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Description
I have an mdbook target whose preprocessor is a py_binary listed in plugins. The build succeeds, but the preprocessor never runs: the marker it should expand is left unchanged, and nothing appears in the build log to say so.
Reproduction steps
MODULE.bazel
module(name = "repro", version = "0.0.0")
bazel_dep(name = "rules_rust_mdbook", version = "0.73.0")
bazel_dep(name = "rules_python", version = "2.2.0")
BUILD.bazel
load("@rules_python//python:defs.bzl", "py_binary")
load("@rules_rust_mdbook//:defs.bzl", "mdbook")
py_binary(
name = "mdbook_secret",
srcs = ["mdbook_secret.py"],
data = ["secret.txt"],
)
mdbook(
name = "book",
srcs = glob(["src/**/*.md"]),
book = "book.toml",
plugins = [":mdbook_secret"],
)
book.toml
[book]
title = "Plugin Runfiles Repro"
src = "src"
[preprocessor.secret]
command = "mdbook_secret"
mdbook_secret.py
#!/usr/bin/env python3
"""Replaces {{secret}} with the contents of a data file."""
import json
import sys
from pathlib import Path
SECRET = Path(__file__).parent / "secret.txt"
def main() -> None:
if len(sys.argv) > 1 and sys.argv[1] == "supports":
sys.exit(0)
secret = SECRET.read_text().strip()
_context, book = json.load(sys.stdin)
for section in book["sections"]:
chapter = section.get("Chapter")
if chapter:
chapter["content"] = chapter["content"].replace("{{secret}}", secret)
print(json.dumps(book))
if __name__ == "__main__":
main()
secret.txt
42
src/SUMMARY.md
# Summary
- [Chapter 1](./chapter_1.md)
src/chapter_1.md
# Chapter 1
The secret is: {{secret}}.
Then:
$ bazel build //:book
INFO: Build completed successfully
$ grep -o "The secret is: [^<]*" bazel-bin/book/chapter_1.html
The secret is: {{secret}}.
Bazel and rules_rust version
Bazel version: 8.7.0
rules_python version 2.2.0
rules_rust_mdbook version: 0.73.0
- 主要语言
- Starlark
- 星标
- 857
- 派生
- 701
- 平均合并
- 4 天 7 小时
- 30 天内合并 PR
- 46
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bazelbuild/rules_rust 的其他 Issue
-
`rust_test(crate = ...)` does not stage the crate's transitive dynamic libraries into runfiles可能已有人在做 @Wito-1 于 66 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
bazelbuild/rules_rust#4309 ·
维护者通常 3 天内回复
-
Windows (no-symlink path): drain_runfiles_dir_windows deletes retained runfiles — inverted filename_suffixes_to_retain condition可能已有人在做 @Mattbusel 于 17 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
bazelbuild/rules_rust#4266 ·
维护者通常 3 天内回复
-
rust.toolchain(strip_level = ...) is silently ignored可能已有人在做 @Mattbusel 于 17 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
bazelbuild/rules_rust#4223 ·
维护者通常 3 天内回复
-
难度 1/5 1-3 小时 新手友好度 90/100
bazelbuild/rules_rust#4152 · 1 个 reaction ·
维护者通常 3 天内回复
-
awaiting-response
难度 2/5 1-3 小时 新手友好度 76/100
bazelbuild/rules_rust#3599 · 1 条评论 ·
维护者通常 3 天内回复
查看 bazelbuild/rules_rust 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
bazelbuild/apple_support#707 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
-
out-of-date
难度 2/5 1-3 小时 新手友好度 68/100
CachyOS/CachyOS-PKGBUILDS#2232 ·
维护者通常 1 天内回复
-
blast/large refactor risk/low spend-dem
难度 2/5 1-3 小时 新手友好度 68/100
chriskelly/MusicWall#87 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
neilotoole/sq#1503 ·
维护者通常 1 天内回复