Skip to content

Commit

Permalink
doc: require hawkmoth for the documentation build
Browse files Browse the repository at this point in the history
Now that we have documentation deployed at GitHub Pages, and we no
longer have to rely on Clang being available at Read The Docs in the
future, require Hawkmoth for the documentation build.

The fallback automock has not been updated in ages, and the
documentation build doesn't even work properly with that anymore. Just
throw it out.
  • Loading branch information
jnikula committed Mar 31, 2023
1 parent 8749e18 commit c5ae12d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 94 deletions.
28 changes: 5 additions & 23 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
sys.path.insert(0, os.path.abspath('..'))

extensions = [
'hawkmoth',
'hawkmoth.ext.javadoc',
'hawkmoth.ext.napoleon',
'sphinx.ext.intersphinx',
]

Expand All @@ -39,33 +42,12 @@
# that this is not the same as Hawkmoth extension minimum version requirement.
needs_sphinx = '4.4'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

# Handle failing hawkmoth import gracefully to be able to build the
# documentation on e.g. https://readthedocs.org/ which would otherwise fail due
# to missing clang.

# This is not a good example to follow in regular documentation.
try:
import hawkmoth
# Setup Clang on Read The Docs
if 'READTHEDOCS' in os.environ:
from hawkmoth.util import readthedocs

readthedocs.clang_setup()

extensions.append('hawkmoth')
extensions.append('hawkmoth.ext.napoleon')
extensions.append('hawkmoth.ext.javadoc')
tags.add('have_hawkmoth')

except ImportError:
sys.stderr.write('Warning: Failed to import hawkmoth. Mocking results.\n')
sys.path.insert(0, os.path.abspath('ext'))
# The mock extension will include the hawkmoth test suite expected results
# into the documentation instead of generating.
extensions.append('automock')

hawkmoth_root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../test/examples')

# Add any paths that contain templates here, relative to this directory.
Expand Down
6 changes: 0 additions & 6 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ This page showcases Hawkmoth in action.
:local:
:depth: 1

.. only:: not have_hawkmoth

.. note:: The documentation you are viewing was built without Hawkmoth and/or
its dependencies (perhaps on https://readthedocs.org/). The output
seen below was pre-generated statically using Hawkmoth, and should
closely reflect actual results.

Overview
--------
Expand Down
59 changes: 0 additions & 59 deletions doc/ext/automock/__init__.py

This file was deleted.

6 changes: 0 additions & 6 deletions test/update-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ def print_header():
:local:
:depth: 1
.. only:: not have_hawkmoth
.. note:: The documentation you are viewing was built without Hawkmoth and/or
its dependencies (perhaps on https://readthedocs.org/). The output
seen below was pre-generated statically using Hawkmoth, and should
closely reflect actual results.
''')

def print_title(testcases):
Expand Down

0 comments on commit c5ae12d

Please sign in to comment.