From d7f0a8bb17089d361bf01fb6c7d751253e06a9fe Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 8 Aug 2023 22:46:25 +0200 Subject: [PATCH] Remove docs/apidocs/ directory if it already exists to ensure we always start with a clean environment when building apidocs. --- docs/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index d3c94288ca..9e6f4cba93 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ import re import sys import glob +import shutil import datetime from sphinx.ext import apidoc @@ -338,6 +339,10 @@ def run_apidoc(_): # Problematic driver with hundreds of issues ignore_paths += ["../libcloud/compute/drivers/outscale.py"] + # Remove existing api docs directory if it exists so we start with a clean environment + apidocs_dir = os.path.abspath(os.path.join(BASE_DIR, "apidocs/")) + shutil.rmtree(apidocs_dir, ignore_errors=True) + argv = [ "--force", # Overwrite output files "--follow-links", # Follow symbolic links