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

Add make target for Dash/Zeal docset #748

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,9 @@ doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

docset:
BUILD_DOCSET=1 $(SPHINXBUILD) -b html -c source/ $(ALLSPHINXOPTS) $(BUILDDIR)/docset_html
@echo "Creating docset with doc2dash"
doc2dash --force --destination $(BUILDDIR) --icon $(BUILDDIR)/docset_html/_static/et.png --name TraitsUI --online-redirect-url http://docs.enthought.com/traitsui/ --index-page index.html $(BUILDDIR)/docset_html
@echo "TraitsUI docset is available in $(BUILDDIR)/TraitsUI.docset"
18 changes: 16 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,24 @@
# absolute, like shown here.
#sys.path.append(os.path.abspath('some/directory'))

# The docset build will use slightly different formatting rules
BUILD_DOCSET = bool(os.environ.get('BUILD_DOCSET'))

# General configuration
# ---------------------


# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.extlinks', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon',
'sphinx.ext.intersphinx', 'traits.util.trait_documenter'
]

if BUILD_DOCSET:
extensions.extend([
'sphinx.ext.autosummary',
])
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down Expand Up @@ -100,6 +108,12 @@
# Options for HTML output
# -----------------------

# When using docset browsers like Dash and Zeal the side bar is redundant.
if BUILD_DOCSET:
html_theme_options = {
'nosidebar': 'true'
}

# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
Expand Down Expand Up @@ -143,10 +157,10 @@
#html_additional_pages = {}

# If false, no module index is generated.
html_use_modindex = False
html_use_modindex = BUILD_DOCSET

# If false, no index is generated.
#html_use_index = False
html_use_index = BUILD_DOCSET

# If true, the index is split into individual pages for each letter.
#html_split_index = False
Expand Down
7 changes: 7 additions & 0 deletions etstool.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
"enthought_sphinx_theme",
}

doc_pip_dependencies = {
"doc2dash",
}

environment_vars = {
'pyside': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyside'},
'pyside2': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyside2'},
Expand Down Expand Up @@ -269,8 +273,10 @@ def docs(runtime, toolkit, environment):
"""
parameters = get_parameters(runtime, toolkit, environment)
packages = ' '.join(doc_dependencies)
packages_pip = ' '.join(doc_pip_dependencies)
commands = [
"edm install -y -e {environment} " + packages,
"edm run -e {environment} -- pip install " + packages_pip,
]
click.echo("Installing documentation tools in '{environment}'".format(
**parameters))
Expand All @@ -280,6 +286,7 @@ def docs(runtime, toolkit, environment):
os.chdir('docs')
commands = [
"edm run -e {environment} -- make html",
"edm run -e {environment} -- make docset",
]
click.echo("Building documentation in '{environment}'".format(**parameters))
try:
Expand Down