Skip to content

Commit

Permalink
doc: extensions: doxyrunner: handle quiet mode
Browse files Browse the repository at this point in the history
QUIET flag is now overriden according to the `doxyrunner_silent`
configuration value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
  • Loading branch information
gmarull authored and carlescufi committed Jul 13, 2021
1 parent 85a0e13 commit 4fcec51
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions doc/_extensions/zephyr/doxyrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,21 @@ def get_doxygen_option(doxyfile: str, option: str) -> List[str]:
def process_doxyfile(
doxyfile: str,
outdir: Path,
silent: bool,
fmt: bool = False,
fmt_pattern: Optional[str] = None,
fmt_vars: Optional[Dict[str, str]] = None,
) -> str:
"""Process Doxyfile.
Notes:
OUTPUT_DIRECTORY and WARN_FORMAT are overridden to satisfy extension
operation needs.
OUTPUT_DIRECTORY, WARN_FORMAT and QUIET are overridden to satisfy
extension operation needs.
Args:
doxyfile: Path to the Doxyfile.
outdir: Output directory of the Doxygen build.
silent: If Doxygen should be run in quiet mode or not.
fmt: If Doxyfile should be formatted.
fmt_pattern: Format pattern.
fmt_vars: Format variables.
Expand All @@ -166,6 +168,13 @@ def process_doxyfile(
flags=re.MULTILINE,
)

content = re.sub(
r"^\s*QUIET\s*=.*$",
"QUIET=" + "YES" if silent else "NO",
content,
flags=re.MULTILINE,
)

if fmt:
if not fmt_pattern or not fmt_vars:
raise ValueError("Invalid formatting pattern or variables")
Expand Down Expand Up @@ -336,6 +345,7 @@ def doxygen_build(app: Sphinx) -> None:
doxyfile = process_doxyfile(
app.config.doxyrunner_doxyfile,
tmp_outdir,
app.config.doxyrunner_silent,
app.config.doxyrunner_fmt,
app.config.doxyrunner_fmt_pattern,
app.config.doxyrunner_fmt_vars,
Expand Down Expand Up @@ -367,7 +377,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value("doxyrunner_fmt", False, "env")
app.add_config_value("doxyrunner_fmt_vars", {}, "env")
app.add_config_value("doxyrunner_fmt_pattern", "@{}@", "env")
app.add_config_value("doxyrunner_silent", False, "")
app.add_config_value("doxyrunner_silent", True, "")

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

Expand Down

0 comments on commit 4fcec51

Please sign in to comment.