Skip to content

Commit bc9574a

Browse files
authored
Merge pull request #5 from harehare/fix/rust-log-build-stdout
🐛 fix(build): suppress RUST_LOG=info stdout pollution during maturin build
2 parents c752f2e + 2e0a9d9 commit bc9574a

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

_maturin_wrapper.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Build backend wrapper for maturin that suppresses RUST_LOG to prevent
3+
INFO-level span close events from being printed to stdout after the wheel path,
4+
which would cause maturin's Python wrapper to misidentify the log line as the path.
5+
"""
6+
import os
7+
8+
os.environ.setdefault("RUST_LOG", "warn")
9+
if os.environ.get("RUST_LOG", "warn").lower() == "info":
10+
os.environ["RUST_LOG"] = "warn"
11+
12+
from maturin import (
13+
build_editable,
14+
build_sdist,
15+
build_wheel,
16+
get_requires_for_build_editable,
17+
get_requires_for_build_sdist,
18+
get_requires_for_build_wheel,
19+
prepare_metadata_for_build_editable,
20+
prepare_metadata_for_build_wheel,
21+
)
22+
23+
__all__ = [
24+
"build_editable",
25+
"build_sdist",
26+
"build_wheel",
27+
"get_requires_for_build_editable",
28+
"get_requires_for_build_sdist",
29+
"get_requires_for_build_wheel",
30+
"prepare_metadata_for_build_editable",
31+
"prepare_metadata_for_build_wheel",
32+
]

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ license = {text = "MIT"}
1313
name = "markdown-query"
1414
readme = "README.md"
1515
requires-python = ">=3.10"
16-
version = "0.5.25"
16+
version = "0.5.26"
1717

1818
[tool.maturin]
1919
module-name = "mq.mq"
2020
python-packages = ["mq"]
2121
python-source = "src"
2222

2323
[build-system]
24-
build-backend = "maturin"
24+
build-backend = "_maturin_wrapper"
25+
backend-path = ["."]
2526
requires = ["maturin>=1.0,<2.0"]
2627

2728
[dependency-groups]

0 commit comments

Comments
 (0)