Skip to content

Commit 4fcec51

Browse files
gmarullcarlescufi
authored andcommitted
doc: extensions: doxyrunner: handle quiet mode
QUIET flag is now overriden according to the `doxyrunner_silent` configuration value. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 85a0e13 commit 4fcec51

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

doc/_extensions/zephyr/doxyrunner.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,21 @@ def get_doxygen_option(doxyfile: str, option: str) -> List[str]:
128128
def process_doxyfile(
129129
doxyfile: str,
130130
outdir: Path,
131+
silent: bool,
131132
fmt: bool = False,
132133
fmt_pattern: Optional[str] = None,
133134
fmt_vars: Optional[Dict[str, str]] = None,
134135
) -> str:
135136
"""Process Doxyfile.
136137
137138
Notes:
138-
OUTPUT_DIRECTORY and WARN_FORMAT are overridden to satisfy extension
139-
operation needs.
139+
OUTPUT_DIRECTORY, WARN_FORMAT and QUIET are overridden to satisfy
140+
extension operation needs.
140141
141142
Args:
142143
doxyfile: Path to the Doxyfile.
143144
outdir: Output directory of the Doxygen build.
145+
silent: If Doxygen should be run in quiet mode or not.
144146
fmt: If Doxyfile should be formatted.
145147
fmt_pattern: Format pattern.
146148
fmt_vars: Format variables.
@@ -166,6 +168,13 @@ def process_doxyfile(
166168
flags=re.MULTILINE,
167169
)
168170

171+
content = re.sub(
172+
r"^\s*QUIET\s*=.*$",
173+
"QUIET=" + "YES" if silent else "NO",
174+
content,
175+
flags=re.MULTILINE,
176+
)
177+
169178
if fmt:
170179
if not fmt_pattern or not fmt_vars:
171180
raise ValueError("Invalid formatting pattern or variables")
@@ -336,6 +345,7 @@ def doxygen_build(app: Sphinx) -> None:
336345
doxyfile = process_doxyfile(
337346
app.config.doxyrunner_doxyfile,
338347
tmp_outdir,
348+
app.config.doxyrunner_silent,
339349
app.config.doxyrunner_fmt,
340350
app.config.doxyrunner_fmt_pattern,
341351
app.config.doxyrunner_fmt_vars,
@@ -367,7 +377,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
367377
app.add_config_value("doxyrunner_fmt", False, "env")
368378
app.add_config_value("doxyrunner_fmt_vars", {}, "env")
369379
app.add_config_value("doxyrunner_fmt_pattern", "@{}@", "env")
370-
app.add_config_value("doxyrunner_silent", False, "")
380+
app.add_config_value("doxyrunner_silent", True, "")
371381

372382
app.connect("builder-inited", doxygen_build)
373383

0 commit comments

Comments
 (0)