Skip to content

Commit 16d1fa9

Browse files
committed
Delete api folder after build to make sure we have a clean working folder
1 parent 3077910 commit 16d1fa9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/source/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@
5858
napoleon_google_docstring = True
5959
smartquotes = False
6060

61+
# Clean up automodapi generated files in source after build to make sure we get a full rebuild next time
62+
def cleanup_automodapi_files(app, exception):
63+
"""Remove automodapi generated files from source directory after build."""
64+
import shutil
65+
api_dir = os.path.join(app.srcdir, 'api')
66+
if os.path.exists(api_dir):
67+
shutil.rmtree(api_dir)
68+
69+
def setup(app):
70+
app.connect('build-finished', cleanup_automodapi_files)
71+
6172
# Add any paths that contain templates here, relative to this directory.
6273
templates_path = ['_templates']
6374

0 commit comments

Comments
 (0)