Skip to content

Commit

Permalink
Merge pull request #4 from thopiekar/make-doc-build-failsave
Browse files Browse the repository at this point in the history
Make doc build failsave
  • Loading branch information
thopiekar committed Jan 24, 2015
2 parents 357a5cb + 7c44907 commit b49963d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ios:
cp -R "iosbuild/usr/local/lib/python2.7/site-packages/kivy" "$(BUILDROOT)/python/lib/python2.7/site-packages"

pdf:
$(MAKE) -C doc latex && make -C doc/build/latex all-pdf
$(MAKE) -C doc pdf

html:
env USE_EMBEDSIGNATURE=1 $(MAKE) force
Expand Down
82 changes: 58 additions & 24 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Makefile for Sphinx documentation
#

ENDUSER_BUILD = yes

# You can set these variables from the command line.
PYTHON = python
SPHINXOPTS = -W
#SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
PYTHON = python
SPHINXOPTS = -Q
SPHINXOPTS_TEST = -W -T
SPHINXBUILD = sphinx-build
PAPER =

# platform indepnt path separator
# only system calls need to use $(P), b/c on win system calls have issues with /
Expand All @@ -20,10 +22,18 @@ endif
P=$(strip $(PATHSEP2))

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sources
ALLSPHINXOPTSGT = -d build/doctrees_gettext $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sources
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sources
ALLSPHINXOPTS_TEST = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS_TEST) sources
ALLSPHINXOPTSGT = -d build/doctrees_gettext $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sources
ALLSPHINXOPTSGT_TEST = -d build/doctrees_gettext $(PAPEROPT_$(PAPER)) $(SPHINXOPTS_TEST) sources

ifeq ($(ENDUSER_BUILD),yes)
_TESTS =
else
_TESTS = _TEST
endif

.PHONY: help clean html web pickle htmlhelp latex changes linkcheck gettext

Expand All @@ -33,6 +43,8 @@ help:
@echo " pickle to make pickle files (usable by e.g. sphinx-web)"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " pdf to make standalone PDF files"
@echo " ps to make standalone PS files"
@echo " changes to make an overview over all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"

Expand All @@ -46,23 +58,23 @@ endif

html:
$(MKDIR) build$(P)html build$(P)doctrees
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS$(_TESTS)) build/html
@echo
@echo "Build finished. The HTML pages are in build/html."

gettext:
$(MKDIR) build$(P)html build$(P)doctrees_gettext
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b gettext $(ALLSPHINXOPTSGT) build/gettext
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b gettext $(ALLSPHINXOPTSGT$(_TESTS)) build/gettext
@echo
@echo "Build finished. The Gettext pages are in build/gettext."


pickle:
$(MKDIR) build$(P)pickle build$(P)doctrees
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS$(_TESTS)) build/pickle
@echo
@echo "Build finished; now you can process the pickle files or run"
@echo " sphinx-web build/pickle"
Expand All @@ -72,32 +84,54 @@ web: pickle

htmlhelp:
$(MKDIR) build$(P)htmlhelp build$(P)doctrees
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS$(_TESTS)) build/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in build/htmlhelp."

latex:
$(MKDIR) build$(P)latex build$(P)doctrees
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS$(_TESTS)) build/latex
@echo
@echo "Build finished; the LaTeX files are in build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
@echo "Run \`make all-pdf' or \`make all-ps' to" \
"run these through (pdf)latex."

pdf: latex
$(MAKE) -C build$(P)latex all-pdf
@echo
@echo "Build finished; the PDF files are in build/latex."

ps: latex
$(MAKE) -C build$(P)latex all-ps
@echo
@echo "Build finished; the PS files are in build/latex."

changes:
$(MKDIR) build$(P)changes build$(P)doctrees
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS$(_TESTS)) build/changes
@echo
@echo "The overview file is in build/changes."

linkcheck:
$(MKDIR) build$(P)linkcheck build$(P)doctrees
$(PYTHON) autobuild.py
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
$(PYTHON) autobuild.py silenced=$(ENDUSER_BUILD)
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS$(_TESTS)) build/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in build/linkcheck/output.txt."

enable-ENDUSER_BUILD:
$(ENDUSER_BUILD) = yes
$(_TESTS) =

disable-ENDUSER_BUILD:
$(ENDUSER_BUILD) = no
$(_TESTS) = _TEST

build-all: html pickle htmlhelp pdf ps gettext

test: disable-ENDUSER_BUILD build-all
11 changes: 9 additions & 2 deletions doc/autobuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
import kivy.garden
from kivy.factory import Factory

# check for silenced build
BE_QUIET = False
for arg in sys.argv:
if "silenced=" in arg:
if arg.split("=")[1] == "yes":
BE_QUIET = True

# force loading of all classes from factory
for x in list(Factory.classes.keys())[:]:
getattr(Factory, x)
Expand All @@ -75,7 +82,7 @@ def writefile(filename, data):
global dest_dir
# avoid to rewrite the file if the content didn't change
f = os.path.join(dest_dir, filename)
print('write', filename)
if not BE_QUIET: print('write', filename)
if os.path.exists(f):
with open(f) as fd:
if fd.read() == data:
Expand Down Expand Up @@ -254,4 +261,4 @@ def extract_summary_line(doc):


# Generation finished
print('Generation finished, do make html')
print('Auto-generation finished')

0 comments on commit b49963d

Please sign in to comment.