Skip to content

Commit

Permalink
Make docs easier to run locally
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
fao89 committed Feb 4, 2022
1 parent 484c5c8 commit a2bf491
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Vagrantfile
docs/_build
docs/_diagrams
docs/api.yaml
docs/pulpdocs/

# Overriden variables
containers/vars/vars.yaml
Expand Down
18 changes: 17 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Makefile for Sphinx documentation
#

SHELL := /bin/bash
# You can set these variables from the command line.
SPHINXOPTS = -W # turn warnings into errors
SPHINXBUILD = sphinx-build
Expand Down Expand Up @@ -45,9 +46,17 @@ clean:
rm -rf $(BUILDDIR)/*
rm -rf $(DIAGRAM_BUILD_DIR)/*

install:
python3 -m venv pulpdocs
source pulpdocs/bin/activate && pip install -r ../doc_requirements.txt

diagrams:
mkdir -p $(DIAGRAM_BUILD_DIR)
ifneq ("$(wildcard pulpdocs/bin/activate)","")
source pulpdocs/bin/activate && python3 -m plantuml diagrams_src/*.dot
else
python3 -m plantuml diagrams_src/*.dot
endif
mv diagrams_src/*.png $(DIAGRAM_BUILD_DIR)/

html:
Expand All @@ -58,7 +67,11 @@ html:
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
ifneq ("$(wildcard pulpdocs/bin/activate)","")
source pulpdocs/bin/activate && PULP_CONTENT_ORIGIN=localhost $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
else
PULP_CONTENT_ORIGIN=localhost $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
endif
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

Expand Down Expand Up @@ -162,3 +175,6 @@ doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

run:
cd $(BUILDDIR) && python -m http.server 8010
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ['_build', 'pulpdocs']

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
Expand Down

0 comments on commit a2bf491

Please sign in to comment.