Skip to content

Commit f9ae1ee

Browse files
author
Karin Hawley
committed
Cleaning up and fixing the docs generation Makefile and README instructions
- moving Makefile to parent folder. This resolves some of the weird path/build issues - remove trace references to cpydiff and original file (no longer used anywhere) - converting SOURCEDIR to a changeable variable, passed through all sphinx-build calls - adding path to conf.py, in case it moves again - making `-v` default with VERBOSE - making `-E` default with FORCE - creating BASEOPTS to store all the dirs, paths, and settings, passing them to sphinx-build in one long chain, instead of individually - updating README to use the make command as default. Also added text explaining some of the customization you can add into a make command
1 parent ad82a2d commit f9ae1ee

File tree

3 files changed

+42
-246
lines changed

3 files changed

+42
-246
lines changed

docs/Makefile renamed to Makefile

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ PYTHON = python3
66
SPHINXOPTS =
77
SPHINXBUILD = sphinx-build
88
PAPER =
9-
BUILDDIR = build/$(MICROPY_PORT)
10-
CPYDIFFDIR = ../tools
11-
CPYDIFF = gen-cpydiff.py
12-
GENRSTDIR = genrst
9+
# path to build the generated docs
10+
BUILDDIR = _build
11+
# path to source files to process
12+
SOURCEDIR = .
13+
# path to conf.py
14+
CONFDIR = .
1315
# Run "make FORCE= ..." to avoid rebuilding from scratch (and risk
1416
# producing incorrect docs).
1517
FORCE = -E
18+
VERBOSE = -v
1619

1720
# User-friendly check for sphinx-build
1821
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
@@ -22,9 +25,10 @@ endif
2225
# Internal variables.
2326
PAPEROPT_a4 = -D latex_paper_size=a4
2427
PAPEROPT_letter = -D latex_paper_size=letter
25-
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
28+
BASEOPTS = -c $(CONFDIR) $(PAPEROPT_$(PAPER)) $(FORCE) $(VERBOSE) $(SPHINXOPTS) $(SOURCEDIR)
29+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
2630
# the i18n builder cannot share the environment and doctrees with the others
27-
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
31+
I18NSPHINXOPTS = $(BASEOPTS)
2832

2933
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
3034

@@ -52,19 +56,12 @@ help:
5256
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
5357
@echo " linkcheck to check all external links for integrity"
5458
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
55-
@echo " cpydiff to generate the MicroPython differences from CPython"
5659

5760
clean:
5861
rm -rf $(BUILDDIR)/*
59-
rm -f $(GENRSTDIR)/*
6062

61-
cpydiff:
62-
@echo "Generating MicroPython Differences."
63-
rm -f $(GENRSTDIR)/*
64-
cd $(CPYDIFFDIR) && $(PYTHON) $(CPYDIFF)
65-
66-
html: cpydiff
67-
$(SPHINXBUILD) $(FORCE) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
63+
html:
64+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
6865
@echo
6966
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
7067

@@ -117,30 +114,34 @@ epub:
117114
@echo
118115
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
119116

120-
latex: cpydiff
117+
latex:
121118
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
122119
@echo
123120
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
124121
@echo "Run \`make' in that directory to run these through (pdf)latex" \
125122
"(use \`make latexpdf' here to do that automatically)."
126123

127-
latexpdf: cpydiff
128-
$(SPHINXBUILD) $(FORCE) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
124+
# seems to be malfunctioning
125+
latexpdf:
126+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
129127
@echo "Running LaTeX files through pdflatex..."
130128
$(MAKE) -C $(BUILDDIR)/latex all-pdf
131129
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
132130

133-
latexpdfja: cpydiff
131+
# seems to be malfunctioning
132+
latexpdfja:
134133
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
135134
@echo "Running LaTeX files through platex and dvipdfmx..."
136135
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
137136
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
138137

138+
# seems to be malfunctioning
139139
text:
140140
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
141141
@echo
142142
@echo "Build finished. The text files are in $(BUILDDIR)/text."
143143

144+
# seems to be malfunctioning
144145
man:
145146
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
146147
@echo

docs/README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ preferably in a virtualenv:
2222

2323
In `circuitpython/`, build the docs:
2424

25-
sphinx-build -v -b html . _build/html
25+
make html
2626

2727
You'll find the index page at `_build/html/index.html`.
28+
29+
### More flexibility
30+
31+
Running `make` by itself will list out the multiple doc generating commands available.
32+
33+
All commands will, by default, run with `-E` (forces a rebuild from scratch of docs) and `-v` (verbosity level 1). This can be customized as desired:
34+
35+
# will turn OFF the force rebuild
36+
make html FORCE=
37+
38+
# will turn OFF the verbosity
39+
make html VERBOSE=
40+
41+
# will turn OFF the force rebuild and make it doubly verbose when running
42+
make html FORCE= VERBOSE="-v -v"
43+
44+
You can also pass other options to sphinx by using `SPHINXOPTS`.
45+
46+
make html SPHINXOPTS="-T"
47+
48+
For more flexibility and customization, take a look at the Makefile for all variables you can pass in and overwrite.

tools/gen-cpydiff.py

Lines changed: 0 additions & 226 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy