Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: require hawkmoth for the documentation build #146

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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