From 883aa2ad13e3c931db413b9fe85c225211f39e08 Mon Sep 17 00:00:00 2001 From: Sebastien Morais Date: Mon, 6 Nov 2023 15:56:02 +0100 Subject: [PATCH] WIP: test clean from sphynx --- .github/workflows/test_first_no_example.yml | 8 ++++---- .github/workflows/test_wf.yml | 12 ++++++------ doc/source/conf.py | 9 +++++++++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_first_no_example.yml b/.github/workflows/test_first_no_example.yml index 2242444c8ab..3e040ed9604 100644 --- a/.github/workflows/test_first_no_example.yml +++ b/.github/workflows/test_first_no_example.yml @@ -86,10 +86,10 @@ jobs: run: | python doc/print_errors.py - - name: Remove files to not upload - run: | - echo "Removing files not wanted in the uploaded artifact" - rm -rf doc/_build/html/.doctrees + # - name: Remove files to not upload + # run: | + # echo "Removing files not wanted in the uploaded artifact" + # rm -rf doc/_build/html/.doctrees - name: Upload HTML documentation artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/test_wf.yml b/.github/workflows/test_wf.yml index 18045169885..ed824a7a082 100644 --- a/.github/workflows/test_wf.yml +++ b/.github/workflows/test_wf.yml @@ -79,12 +79,12 @@ jobs: # testenv\Scripts\Activate.ps1 # .\doc\make.bat pdf - # TODO: update upload action once path exclusion is implemented (if ever) - # see https://github.com/actions/upload-pages-artifact/issues/33 - - name: Remove files to not upload - run: | - echo "Removing files not wanted in the uploaded artifact" - Remove-Item doc/_build/html/.doctrees -Recurse -Force + # # TODO: update upload action once path exclusion is implemented (if ever) + # # see https://github.com/actions/upload-pages-artifact/issues/33 + # - name: Remove files to not upload + # run: | + # echo "Removing files not wanted in the uploaded artifact" + # Remove-Item doc/_build/html/.doctrees -Recurse -Force - name: Upload HTML documentation artifact uses: actions/upload-artifact@v3 diff --git a/doc/source/conf.py b/doc/source/conf.py index 11b180ef38e..41d6c8cfa27 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -21,6 +21,8 @@ from docutils.parsers.rst import Directive from docutils import nodes from sphinx import addnodes +from sphinx.util import rmtree + # <-----------------Override the sphinx pdf builder----------------> # Some pages do not render properly as per the expected Sphinx LaTeX PDF signature. @@ -70,9 +72,16 @@ def autodoc_skip_member(app, what, name, obj, skip, options): # return True if exclude else None +def remove_doctree(app, exception): + """Remove the .doctree directory created during the documentation build. + """ + rmtree(app.doctreedir) + + def setup(app): app.add_directive('pprint', PrettyPrintDirective) app.connect('autodoc-skip-member', autodoc_skip_member) + app.connect('build-finished', remove_doctree) local_path = os.path.dirname(os.path.realpath(__file__))