From 7bd5212484a9d7a2032b17bad45a185ede14373e Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sun, 11 Apr 2021 15:44:50 +0200 Subject: [PATCH] generator: Always update docs.md for non-sys crates --- generator.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/generator.py b/generator.py index a9c47bf67..ca270153b 100755 --- a/generator.py +++ b/generator.py @@ -87,11 +87,30 @@ def regen_crates(path, conf): "-o", path.parent, ] + [d for path in conf.gir_files_paths for d in ("-d", path)] + error = False if path.parent.name.endswith("sys"): args.extend(["-m", "sys"]) - error = False + else: + # Update docs/**/docs.md for non-sys crates + + # doc-target-path is relative to `-c` + path_depth = len(path.parent.parts) + doc_path = ( + Path(*[".."] * path_depth, "docs") + .joinpath(path.parent) + .joinpath("docs.md") + ) + print("==> Docs into {}".format(doc_path)) + doc_args = args + [ + "-m", + "doc", + "--doc-target-path", + doc_path, + ] + error |= not run_command(doc_args) + try: - error = not run_command(args) + error |= not run_command(args) except Exception as err: print("The following error occurred: {}".format(err)) error = True