aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-29 14:18:29 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-29 14:25:34 +0100
commit49353faf76fd8d9a26e6304a5816ccc026c5f9a1 (patch)
tree4464c4e837d59c11bc4b6c7e744694b805d2d22e /tools
parented095a59eb91b48bd4e62e0b3d6005ab2d058d17 (diff)
Fix customgeometry.pyproject file
It caused: File "tools/example_gallery/main.py", line 298, in <module> content_f += get_code_tabs(pyproject["files"], out_f) KeyError: 'files' Amends b9ec49942b3ad53343317e631320c58e59736c22. As a drive-by, handle the error in the gallery tool. Pick-to: 6.2 Change-Id: Ideca9ccb72021780cf8ae7b3f2204733cc2f5e4f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/example_gallery/main.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/example_gallery/main.py b/tools/example_gallery/main.py
index f19b530b3..4959abc34 100644
--- a/tools/example_gallery/main.py
+++ b/tools/example_gallery/main.py
@@ -262,15 +262,16 @@ if __name__ == "__main__":
}
)
- pyproject = ""
+ files = []
try:
with open(str(f_path), "r") as pyf:
pyproject = json.load(pyf)
- except json.JSONDecodeError as e:
+ files = pyproject["files"]
+ except (json.JSONDecodeError, KeyError) as e:
print(f"example_gallery: error reading {f_path}: {e}")
raise
- if pyproject:
+ if files:
rst_file_full = EXAMPLES_DOC / rst_file
with open(rst_file_full, "w") as out_f:
@@ -295,7 +296,7 @@ if __name__ == "__main__":
print("Written resource:", resource_written)
else:
content_f = get_header_title(f_path)
- content_f += get_code_tabs(pyproject["files"], out_f)
+ content_f += get_code_tabs(files, out_f)
out_f.write(content_f)
if not opt_quiet: