Skip to content

Commit f65bdbd

Browse files
committed
Simplify, standardize sphinx setup
1 parent 589cad5 commit f65bdbd

14 files changed

Lines changed: 41 additions & 117 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*.pyc
99
*.pyo
1010
build
11+
_build
1112
*.prof
1213
siteconf.py
1314
doc/hedge-notes.pdf

doc/Makefile

Lines changed: 14 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,20 @@
1-
# Makefile for Sphinx documentation
1+
# Minimal makefile for Sphinx documentation
22
#
33

4-
# You can set these variables from the command line.
5-
SPHINXOPTS =
6-
SPHINXBUILD = python3 `which sphinx-build`
7-
PAPER =
8-
9-
# Internal variables.
10-
PAPEROPT_a4 = -D latex_paper_size=a4
11-
PAPEROPT_letter = -D latex_paper_size=letter
12-
ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
13-
14-
.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?= -n
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
1510

11+
# Put it first so that "make" without argument is like "make help".
1612
help:
17-
@echo "Please use \`make <target>' where <target> is one of"
18-
@echo " html to make standalone HTML files"
19-
@echo " pickle to make pickle files (usable by e.g. sphinx-web)"
20-
@echo " htmlhelp to make HTML files and a HTML help project"
21-
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
22-
@echo " changes to make an overview over all changed/added/deprecated items"
23-
@echo " linkcheck to check all external links for integrity"
24-
25-
clean:
26-
-rm -rf build/*
27-
28-
html:
29-
mkdir -p build/html build/doctrees source/.static
30-
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
31-
@echo
32-
@echo "Build finished. The HTML pages are in build/html."
33-
34-
pickle:
35-
mkdir -p build/pickle build/doctrees
36-
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
37-
@echo
38-
@echo "Build finished; now you can process the pickle files or run"
39-
@echo " sphinx-web build/pickle"
40-
@echo "to start the sphinx-web server."
41-
42-
web: pickle
43-
44-
htmlhelp:
45-
mkdir -p build/htmlhelp build/doctrees
46-
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
47-
@echo
48-
@echo "Build finished; now you can run HTML Help Workshop with the" \
49-
".hhp project file in build/htmlhelp."
50-
51-
latex:
52-
mkdir -p build/latex build/doctrees
53-
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
54-
@echo
55-
@echo "Build finished; the LaTeX files are in build/latex."
56-
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
57-
"run these through (pdf)latex."
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
5814

59-
changes:
60-
mkdir -p build/changes build/doctrees
61-
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
62-
@echo
63-
@echo "The overview file is in build/changes."
15+
.PHONY: help Makefile
6416

65-
linkcheck:
66-
mkdir -p build/linkcheck build/doctrees
67-
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
68-
@echo
69-
@echo "Link check complete; look for any errors in the above output " \
70-
"or in build/linkcheck/output.txt."
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
File renamed without changes.

doc/conf.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from urllib.request import urlopen
2+
3+
_conf_url = \
4+
"https://raw.githubusercontent.com/inducer/sphinxconfig/main/sphinxconfig.py"
5+
with urlopen(_conf_url) as _inf:
6+
exec(compile(_inf.read(), _conf_url, "exec"), globals())
7+
8+
copyright = "2008-21, Andreas Kloeckner"
9+
10+
ver_dic = {}
11+
exec(
12+
compile(
13+
open("../pycuda/__init__.py").read(), "../pycuda/__init__.py", "exec"
14+
),
15+
ver_dic,
16+
)
17+
version = ".".join(str(x) for x in ver_dic["VERSION"])
18+
# The full version, including alpha/beta/rc tags.
19+
release = ver_dic["VERSION_TEXT"]
20+
21+
intersphinx_mapping = {
22+
"https://docs.python.org/3": None,
23+
"https://numpy.org/doc/stable/": None,
24+
"https://documen.tician.de/codepy/": None,
25+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)