aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-29 14:18:29 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-29 18:16:59 +0000
commitd7d78d45a3a322cb45c0b0f8f1b754f4bda8407a (patch)
tree3be32ea62cd4a86fb088b5edf2332edddd0cafda
parent389538e2ecb4b07c28ce274087baacdac51996d8 (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. Change-Id: Ideca9ccb72021780cf8ae7b3f2204733cc2f5e4f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 49353faf76fd8d9a26e6304a5816ccc026c5f9a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/quick3d/customgeometry/customgeometry.pyproject2
-rw-r--r--tools/example_gallery/main.py9
2 files changed, 6 insertions, 5 deletions
diff --git a/examples/quick3d/customgeometry/customgeometry.pyproject b/examples/quick3d/customgeometry/customgeometry.pyproject
index 45f906e20..3e31ac931 100644
--- a/examples/quick3d/customgeometry/customgeometry.pyproject
+++ b/examples/quick3d/customgeometry/customgeometry.pyproject
@@ -1,3 +1,3 @@
{
- "file": ["examplepoint.py", "exampletriangle.py", "main.py", "main.qml", "resources.qrc"]
+ "files": ["examplepoint.py", "exampletriangle.py", "main.py", "main.qml", "resources.qrc"]
}
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: