diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-12 14:25:36 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-12 16:30:48 +0200 |
| commit | b1a0a9c6c6d5d6399da76c4a22f3786737f2eb2e (patch) | |
| tree | 10d435702c4fbd5c5a17a24d28c4d844269614d3 /tools/example_gallery/main.py | |
| parent | 57558f47e1b61d6b6598efbdfaa88c1c34ae8ba8 (diff) | |
example_gallery: Remove existing target directory
Pick-to: 6.5
Initial-patch-by: Dennis Oberst <dennis.oberst@qt.io>
Task-number: PYSIDE-1106
Change-Id: I76466254b455ac07f8b537e2e758d6720885c128
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'tools/example_gallery/main.py')
| -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": |
