diff --git a/Makefile.sphinx b/Makefile.sphinx index 2f2b78a..0af4b0f 100644 --- a/Makefile.sphinx +++ b/Makefile.sphinx @@ -1,52 +1,53 @@ # Makefile to be included by other modules, from the TOPLEVEL/docs/ dir, to # automatically build sphinx documentation. APIDOC_DIR = apidoc APIDOC_OPTS = --ext-viewcode --separate SPHINXBUILD = sphinx-build SPHINXAPIDOC = sphinx-apidoc SPHINX_OPTS = SPHINX_BUILDDIR = _build SPHINX_SRCDIR = . # relative to docs/ dir. Hence "." exclude the docs/ dir itself -APIDOC_EXCLUDES = . ../setup.py ../conftest.py ../swh/*/conftest.py -APIDOC_EXCLUDES += ../swh/*/tests ../swh/*/tests/* ../swh/*/*/tests/* ../swh/*/*/*/tests/* -APIDOC_EXCLUDES += ../swh/*/migrations ../swh/*/migrations/* ../swh/*/*/migrations/* ../swh/*/*/*/migrations/* -APIDOC_EXCLUDES += ../bin ../dist ../utils ../node_modules +APIDOC_EXCLUDES = conftest.py setup.py +APIDOC_EXCLUDES += */tests/* */migrations/* */wsgi.py */conftest.py +APIDOC_EXCLUDES += deposit/settings/* web/settings/* dataset/* +APIDOC_EXCLUDES += bin build dist utils node_modules +APIDOC_SWH_EXCLUDES = $(patsubst %,"../%",$(APIDOC_EXCLUDES)) html: sphinx/html help: sphinx/help # allow to skip apidoc generation, for modules where the overall documentation # structure, table of contents, etc., is manually curated ifeq ($(SKIP_APIDOC),yes) apidoc_dep = else apidoc_dep = apidoc-stamp endif sphinx/clean: - $(SPHINXBUILD) -M clean $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR) $(SPHINXOPTS) + $(SPHINXBUILD) -M clean $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR) $(SPHINX_OPTS) sphinx/%: $(apidoc_dep) - $(SPHINXBUILD) -b $* $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR)/$* $(SPHINXOPTS) + $(SPHINXBUILD) -b $* $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR)/$* $(SPHINX_OPTS) apidoc: $(apidoc_dep) apidoc-stamp: - $(SPHINXAPIDOC) $(APIDOC_OPTS) -o $(APIDOC_DIR) .. $(APIDOC_EXCLUDES) + $(SPHINXAPIDOC) $(APIDOC_OPTS) -o $(APIDOC_DIR) .. $(APIDOC_SWH_EXCLUDES) # to silent Sphinx warnings about apidoc documents not included in any toctree find $(shell pwd)/apidoc -name "*.rst" | xargs sed -i '1i:orphan:\n' touch $@ assets: .PHONY: clean clean-apidoc clean: sphinx/clean clean-apidoc clean-apidoc: rm -rf $(APIDOC_DIR) rm -f *-stamp # Local Variables: # mode: makefile # End: diff --git a/docs/Makefile b/docs/Makefile index 2f9fafd..aa4a0f8 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,84 +1,81 @@ SPHINXOPTS ?= SPHINXOPTCOLOR ?= --color SPHINXBUILD = sphinx-build SOURCEDIR = . BUILDDIR = _build HTMLDIR = $(BUILDDIR)/html SWHPKGDIR ?= sources/swh/ INSTALL_HOST = pergamon.internal.softwareheritage.org INSTALL_DIR = /srv/softwareheritage/docs/webroot/devel INSTALL_GROUP = swhdev INSTALL_PERMS = g+rwX SPHINXAPIDOC = sphinx-apidoc APIDOC_DIR = apidoc APIDOC_OPTS = --ext-viewcode --separate --no-toc -APIDOC_EXCLUDES = */tests */tests/* */*/tests/* */*/*/tests/* -APIDOC_EXCLUDES += */migrations */migrations/* */*/migrations/* */*/*/migrations/* -APIDOC_EXCLUDES += */wsgi.py */*/wsgi.py */*/*/wsgi.py -APIDOC_EXCLUDES += */conftest.py */*/conftest.py */*/*/conftest.py +APIDOC_EXCLUDES = */tests */migrations */wsgi.py */conftest.py */setup.py APIDOC_EXCLUDES += deposit/settings/* web/settings/* dataset/* -APIDOC_SWH_EXCLUDES = $(patsubst %,$(SWHPKGDIR)/%,$(APIDOC_EXCLUDES)) +APIDOC_SWH_EXCLUDES = $(patsubst %,"$(SWHPKGDIR)/%",$(APIDOC_EXCLUDES)) html: sphinx/html sphinx/html: links-stamp apidoc-stamp images-stamp rec-build-stamp links-stamp: mkdir -p sources/swh bin/ln-sphinx-subprojects touch $@ apidoc: apidoc-stamp apidoc-stamp: links-stamp $(SPHINXAPIDOC) \ --implicit-namespaces \ --templatedir=../swh/docs/templates/ \ --maxdepth=3 \ $(APIDOC_OPTS) \ -o $(APIDOC_DIR) \ $(SWHPKGDIR) \ $(APIDOC_SWH_EXCLUDES) touch $@ # remove warning about swh.rst not being included in any toctree sed -i '1s/^/:orphan:\n\n/' $(APIDOC_DIR)/swh.rst images-stamp: $(MAKE) -C images $(MAKE) -C swh-deposit/images touch $@ # Build documentation recursively in all packages, to make sure that auxiliary, # non-sphinx managed documentation artifacts (e.g., schema diagrams) are also # built. rec-build-stamp: $(wildcard ../../swh-*/docs/*.rst) $(MAKE) -C ../../ docs-assets touch $@ clean: sphinx/clean bin/ln-sphinx-subprojects --remove $(MAKE) -C images clean rm -f *-stamp rm -f $(APIDOC_DIR)/* distclean: clean make -C ../../ docs-clean help: sphinx/help sphinx/clean: $(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(SPHINXOPTCOLOR) sphinx/%: $(SPHINXBUILD) -b $* "$(SOURCEDIR)" "$(BUILDDIR)/$*" $(SPHINXOPTS) $(SPHINXOPTCOLOR) install: html test -d $(HTMLDIR) rsync -rlvuz --delete $(BUILDDIR)/html/ $(INSTALL_HOST):$(INSTALL_DIR)/ ssh $(INSTALL_HOST) \ "find $(INSTALL_DIR) -not -group $(INSTALL_GROUP) -exec chgrp -v $(INSTALL_GROUP) {} + ; \ find $(INSTALL_DIR) -not -perm -ug=rw,o=r -exec chmod -v ug+rw,o+r {} + ; \ find $(INSTALL_DIR) -type d -not -perm -g=xs,ou=x -exec chmod -v g+xs,ou+x {} +" .PHONY: help html clean distclean install images-stamp