Check for doc build dependency before building

The import error produced when the sphinxcontrib-httpdomain
package is missing is for sphinxcontrib.autohttp.flask,
but the package to install is sphinxcontrib-httpdomain.
This check produces a more useful error message than
allowing Sphinx to report the import error by itself.

Change-Id: I2f53761da47b593e74d12c7dd213e69e4d71db21
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2012-08-31 12:04:26 -04:00
parent e985278139
commit b3c187aea9

View File

@ -41,11 +41,15 @@ help:
clean:
-rm -rf $(BUILDDIR)/*
html:
html: check-dependencies
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: check-dependencies
check-dependencies:
@python -c 'import sphinxcontrib.autohttp.flask' >/dev/null 2>&1 || (echo "ERROR: Missing Sphinx dependencies. Run: pip install sphinxcontrib-httpdomain" && exit 1)
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo