diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-12 14:25:36 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-12 16:03:09 +0000 |
commit | 53ebe5341db898caa08c22af93d017579b9790ad (patch) | |
tree | e3b88abf0fd85ab49229e300f0785e89e998cc51 | |
parent | e2958f37979fcf4ff336b9d7256930ba33a47471 (diff) |
example_gallery: Remove existing target directory
Initial-patch-by: Dennis Oberst <dennis.oberst@qt.io>
Task-number: PYSIDE-1106
Change-Id: I76466254b455ac07f8b537e2e758d6720885c128
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit b1a0a9c6c6d5d6399da76c4a22f3786737f2eb2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tools/example_gallery/main.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/example_gallery/main.py b/tools/example_gallery/main.py index 23892c57a..e27c07c4c 100644 --- a/tools/example_gallery/main.py +++ b/tools/example_gallery/main.py @@ -375,7 +375,7 @@ if __name__ == "__main__": options = parser.parse_args() opt_quiet = options.quiet if options.target_dir: - EXAMPLES_DOC = Path(options.target_dir) + EXAMPLES_DOC = Path(options.target_dir).resolve() # This main loop will be in charge of: # * Getting all the .pyproject files, @@ -385,8 +385,12 @@ if __name__ == "__main__": examples = {} # Create the 'examples' directory if it doesn't exist - if not EXAMPLES_DOC.is_dir(): - EXAMPLES_DOC.mkdir() + # If it does exist, remove it and create a new one to start fresh + if EXAMPLES_DOC.is_dir(): + shutil.rmtree(EXAMPLES_DOC, ignore_errors=True) + if not opt_quiet: + print("WARNING: Deleted old html directory") + EXAMPLES_DOC.mkdir() for pyproject_file in EXAMPLES_DIR.glob("**/*.pyproject"): if pyproject_file.name != "examples.pyproject": |