aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-12-08 08:38:34 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-12-08 12:12:16 +0100
commitf3972822d254ad20b8e9582f89fe8e30ce931f5c (patch)
tree8fcb8aba6b46a6c3308f5721bbc929f0e1c32e72
parent8cbfe9aa6f46483968b8273aa45deaad12bffbfd (diff)
Documentation: Generate the examples directly into the build directory
Pick-to: 6.2 Change-Id: If395979b5a1efa869b3c1c7cb12b53bd1e8f1f7c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/pyside6/doc/CMakeLists.txt3
-rw-r--r--tools/example_gallery/main.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/sources/pyside6/doc/CMakeLists.txt b/sources/pyside6/doc/CMakeLists.txt
index ddb58d453..2beb35bbb 100644
--- a/sources/pyside6/doc/CMakeLists.txt
+++ b/sources/pyside6/doc/CMakeLists.txt
@@ -118,8 +118,9 @@ endif()
# Generate example gallery
message(STATUS "Generating example gallery")
+set(EXAMPLE_TOOL_OPTIONS --target "${CMAKE_CURRENT_BINARY_DIR}/rst/examples")
if (QUIET_BUILD)
- set (EXAMPLE_TOOL_OPTIONS "-q")
+ list(APPEND EXAMPLE_TOOL_OPTIONS "-q")
endif()
set(EXAMPLE_TOOL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../tools/example_gallery/main.py")
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${EXAMPLE_TOOL_DIR} ${EXAMPLE_TOOL_OPTIONS}
diff --git a/tools/example_gallery/main.py b/tools/example_gallery/main.py
index d6e6468bd..2cecab6fb 100644
--- a/tools/example_gallery/main.py
+++ b/tools/example_gallery/main.py
@@ -204,9 +204,13 @@ if __name__ == "__main__":
gallery = ""
parser = ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter)
+ TARGET_HELP = f"Directory into which to generate RST files (default: {str(EXAMPLES_DOC)})"
+ parser.add_argument("--target", "-t", action="store", dest="target_dir", help=TARGET_HELP)
parser.add_argument("--quiet", "-q", action="store_true", help="Quiet")
options = parser.parse_args()
opt_quiet = options.quiet
+ if options.target_dir:
+ EXAMPLES_DOC = Path(options.target_dir)
# This main loop will be in charge of:
# * Getting all the .pyproject files,