Skip to content

Commit 7746737

Browse files
authored
Fix Makefile when sphinx is not available (#451)
* Fix Makefile when sphinx is not available * Add release notes
1 parent 4f194b6 commit 7746737

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

docs/Makefile

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
99

10-
# User-friendly check for sphinx-build
11-
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12-
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
13-
endif
10+
.PHONY: sphinx
11+
sphinx:
12+
# User-friendly check for sphinx-build
13+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
14+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
15+
endif
1416

1517
# Internal variables.
1618
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -54,44 +56,44 @@ clean:
5456
rm -rf $(BUILDDIR)/*
5557

5658
.PHONY: html
57-
html:
59+
html: sphinx
5860
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5961
@echo
6062
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
6163

6264
.PHONY: dirhtml
63-
dirhtml:
65+
dirhtml: sphinx
6466
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
6567
@echo
6668
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
6769

6870
.PHONY: singlehtml
69-
singlehtml:
71+
singlehtml: sphinx
7072
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
7173
@echo
7274
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
7375

7476
.PHONY: pickle
75-
pickle:
77+
pickle: sphinx
7678
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
7779
@echo
7880
@echo "Build finished; now you can process the pickle files."
7981

8082
.PHONY: json
81-
json:
83+
json: sphinx
8284
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
8385
@echo
8486
@echo "Build finished; now you can process the JSON files."
8587

8688
.PHONY: htmlhelp
87-
htmlhelp:
89+
htmlhelp: sphinx
8890
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
8991
@echo
9092
@echo "Build finished; now you can run HTML Help Workshop with the" \
9193
".hhp project file in $(BUILDDIR)/htmlhelp."
9294

9395
.PHONY: qthelp
94-
qthelp:
96+
qthelp: sphinx
9597
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
9698
@echo
9799
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
@@ -101,7 +103,7 @@ qthelp:
101103
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zarr.qhc"
102104

103105
.PHONY: applehelp
104-
applehelp:
106+
applehelp: sphinx
105107
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
106108
@echo
107109
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@@ -110,7 +112,7 @@ applehelp:
110112
"bundle."
111113

112114
.PHONY: devhelp
113-
devhelp:
115+
devhelp: sphinx
114116
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
115117
@echo
116118
@echo "Build finished."
@@ -120,111 +122,112 @@ devhelp:
120122
@echo "# devhelp"
121123

122124
.PHONY: epub
123-
epub:
125+
epub: sphinx
124126
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
125127
@echo
126128
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
127129

128130
.PHONY: epub3
129-
epub3:
131+
epub3: sphinx
130132
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
131133
@echo
132134
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
133135

134136
.PHONY: latex
135-
latex:
137+
latex: sphinx
136138
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
137139
@echo
138140
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
139141
@echo "Run \`make' in that directory to run these through (pdf)latex" \
140142
"(use \`make latexpdf' here to do that automatically)."
141143

142144
.PHONY: latexpdf
143-
latexpdf:
145+
latexpdf: sphinx
144146
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
145147
@echo "Running LaTeX files through pdflatex..."
146148
$(MAKE) -C $(BUILDDIR)/latex all-pdf
147149
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
148150

149151
.PHONY: latexpdfja
150-
latexpdfja:
152+
latexpdfja: sphinx
151153
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
152154
@echo "Running LaTeX files through platex and dvipdfmx..."
153155
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
154156
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
155157

156158
.PHONY: text
157-
text:
159+
text: sphinx
158160
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
159161
@echo
160162
@echo "Build finished. The text files are in $(BUILDDIR)/text."
161163

162164
.PHONY: man
163-
man:
165+
man: sphinx
164166
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
165167
@echo
166168
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
167169

168170
.PHONY: texinfo
169-
texinfo:
171+
texinfo: sphinx
170172
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
171173
@echo
172174
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
173175
@echo "Run \`make' in that directory to run these through makeinfo" \
174176
"(use \`make info' here to do that automatically)."
175177

176178
.PHONY: info
177-
info:
179+
info: sphinx
178180
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
179181
@echo "Running Texinfo files through makeinfo..."
180182
make -C $(BUILDDIR)/texinfo info
181183
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
182184

183185
.PHONY: gettext
184-
gettext:
186+
gettext: sphinx
185187
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
186188
@echo
187189
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
188190

189191
.PHONY: changes
190-
changes:
192+
changes: sphinx
191193
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
192194
@echo
193195
@echo "The overview file is in $(BUILDDIR)/changes."
194196

195197
.PHONY: linkcheck
196-
linkcheck:
198+
linkcheck: sphinx
197199
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
198200
@echo
199201
@echo "Link check complete; look for any errors in the above output " \
200202
"or in $(BUILDDIR)/linkcheck/output.txt."
201203

202204
.PHONY: doctest
203-
doctest:
205+
doctest: sphinx
204206
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
205207
@echo "Testing of doctests in the sources finished, look at the " \
206208
"results in $(BUILDDIR)/doctest/output.txt."
207209

208210
.PHONY: coverage
209-
coverage:
211+
coverage: sphinx
210212
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
211213
@echo "Testing of coverage in the sources finished, look at the " \
212214
"results in $(BUILDDIR)/coverage/python.txt."
213215

214216
.PHONY: xml
215-
xml:
217+
xml: sphinx
216218
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
217219
@echo
218220
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
219221

220222
.PHONY: pseudoxml
221-
pseudoxml:
223+
pseudoxml: sphinx
222224
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
223225
@echo
224226
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
225227

226228
.PHONY: dummy
227-
dummy:
229+
dummy: sphinx
228230
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
229231
@echo
230232
@echo "Build finished. Dummy builder generates no files."
233+

docs/release.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Enhancements
2121
Fix
2222
~~~
2323

24-
*
24+
* Fixed docs/Makefile error message when sphinx is not present
2525

2626
Maintenance
2727
~~~~~~~~~~~

0 commit comments

Comments
 (0)