Skip to content

Commit 94dbc3c

Browse files
authored
Remove Sphinx version duplication (#695)
The version specified in the documentation is provided by the Sphinx config in `docs/conf.py`. This duplicates the version specified in `hazelcast/init.py`, and previously [became outdated](#690). Unfortunately, in this PR I updated the version incorrectly (i.e. to `5.4.0`, not `5.5.0`), highlighting the issues with duplicating this data. Instead, we should have a single place the version if specified, and reference it in the Sphinx config. Example output following this change: <img width="898" alt="image" src="https://github.com/user-attachments/assets/36718c1f-fdfc-406c-bbf8-31d9ac207ff5"> In addition, while trying to build the documents locally, `make html` failed with a cryptic error message: > *** commands commence before first target. Stop. I didn't have Sphinx installed, and while `make` was happy to evaluate the `if` check for it's existence, printing an error message was disallowed outside of a target. Fixed by adding a target, and requiring that on any Sphinx related targets. This can be tested by updating the `SPHINXBUILD` command to something that doesn't exist and trying to build the documentation: > % make html Makefile:13: *** The 'non-existant-sphinx-build' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the 'non-existant-sphinx-build' 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/. Stop.
1 parent fc30677 commit 94dbc3c

File tree

2 files changed

+32
-29
lines changed

2 files changed

+32
-29
lines changed

docs/Makefile

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
99

10-
# User-friendly check for sphinx-build
10+
.PHONY: check-sphinx
11+
check-sphinx:
1112
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
1213
$(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/)
1314
endif
@@ -54,44 +55,44 @@ clean:
5455
rm -rf $(BUILDDIR)/*
5556

5657
.PHONY: html
57-
html:
58+
html: check-sphinx
5859
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5960
@echo
6061
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
6162

6263
.PHONY: dirhtml
63-
dirhtml:
64+
dirhtml: check-sphinx
6465
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
6566
@echo
6667
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
6768

6869
.PHONY: singlehtml
69-
singlehtml:
70+
singlehtml: check-sphinx
7071
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
7172
@echo
7273
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
7374

7475
.PHONY: pickle
75-
pickle:
76+
pickle: check-sphinx
7677
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
7778
@echo
7879
@echo "Build finished; now you can process the pickle files."
7980

8081
.PHONY: json
81-
json:
82+
json: check-sphinx
8283
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
8384
@echo
8485
@echo "Build finished; now you can process the JSON files."
8586

8687
.PHONY: htmlhelp
87-
htmlhelp:
88+
htmlhelp: check-sphinx
8889
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
8990
@echo
9091
@echo "Build finished; now you can run HTML Help Workshop with the" \
9192
".hhp project file in $(BUILDDIR)/htmlhelp."
9293

9394
.PHONY: qthelp
94-
qthelp:
95+
qthelp: check-sphinx
9596
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
9697
@echo
9798
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
@@ -101,7 +102,7 @@ qthelp:
101102
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/HazelcastPythonClient.qhc"
102103

103104
.PHONY: applehelp
104-
applehelp:
105+
applehelp: check-sphinx
105106
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
106107
@echo
107108
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@@ -110,7 +111,7 @@ applehelp:
110111
"bundle."
111112

112113
.PHONY: devhelp
113-
devhelp:
114+
devhelp: check-sphinx
114115
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
115116
@echo
116117
@echo "Build finished."
@@ -120,111 +121,111 @@ devhelp:
120121
@echo "# devhelp"
121122

122123
.PHONY: epub
123-
epub:
124+
epub: check-sphinx
124125
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
125126
@echo
126127
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
127128

128129
.PHONY: epub3
129-
epub3:
130+
epub3: check-sphinx
130131
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
131132
@echo
132133
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
133134

134135
.PHONY: latex
135-
latex:
136+
latex: check-sphinx
136137
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
137138
@echo
138139
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
139140
@echo "Run \`make' in that directory to run these through (pdf)latex" \
140141
"(use \`make latexpdf' here to do that automatically)."
141142

142143
.PHONY: latexpdf
143-
latexpdf:
144+
latexpdf: check-sphinx
144145
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
145146
@echo "Running LaTeX files through pdflatex..."
146147
$(MAKE) -C $(BUILDDIR)/latex all-pdf
147148
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
148149

149150
.PHONY: latexpdfja
150-
latexpdfja:
151+
latexpdfja: check-sphinx
151152
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
152153
@echo "Running LaTeX files through platex and dvipdfmx..."
153154
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
154155
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
155156

156157
.PHONY: text
157-
text:
158+
text: check-sphinx
158159
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
159160
@echo
160161
@echo "Build finished. The text files are in $(BUILDDIR)/text."
161162

162163
.PHONY: man
163-
man:
164+
man: check-sphinx
164165
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
165166
@echo
166167
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
167168

168169
.PHONY: texinfo
169-
texinfo:
170+
texinfo: check-sphinx
170171
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
171172
@echo
172173
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
173174
@echo "Run \`make' in that directory to run these through makeinfo" \
174175
"(use \`make info' here to do that automatically)."
175176

176177
.PHONY: info
177-
info:
178+
info: check-sphinx
178179
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
179180
@echo "Running Texinfo files through makeinfo..."
180181
make -C $(BUILDDIR)/texinfo info
181182
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
182183

183184
.PHONY: gettext
184-
gettext:
185+
gettext: check-sphinx
185186
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
186187
@echo
187188
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
188189

189190
.PHONY: changes
190-
changes:
191+
changes: check-sphinx
191192
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
192193
@echo
193194
@echo "The overview file is in $(BUILDDIR)/changes."
194195

195196
.PHONY: linkcheck
196-
linkcheck:
197+
linkcheck: check-sphinx
197198
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
198199
@echo
199200
@echo "Link check complete; look for any errors in the above output " \
200201
"or in $(BUILDDIR)/linkcheck/output.txt."
201202

202203
.PHONY: doctest
203-
doctest:
204+
doctest: check-sphinx
204205
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
205206
@echo "Testing of doctests in the sources finished, look at the " \
206207
"results in $(BUILDDIR)/doctest/output.txt."
207208

208209
.PHONY: coverage
209-
coverage:
210+
coverage: check-sphinx
210211
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
211212
@echo "Testing of coverage in the sources finished, look at the " \
212213
"results in $(BUILDDIR)/coverage/python.txt."
213214

214215
.PHONY: xml
215-
xml:
216+
xml: check-sphinx
216217
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
217218
@echo
218219
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
219220

220221
.PHONY: pseudoxml
221-
pseudoxml:
222+
pseudoxml: check-sphinx
222223
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
223224
@echo
224225
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
225226

226227
.PHONY: dummy
227-
dummy:
228+
dummy: check-sphinx
228229
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
229230
@echo
230231
@echo "Build finished. Dummy builder generates no files."

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
2121
sys.path.insert(0, os.path.abspath(".."))
2222

23+
from hazelcast import __version__
24+
2325
# -- General configuration ------------------------------------------------
2426

2527
# If your documentation needs a minimal Sphinx version, state it here.
@@ -72,9 +74,9 @@
7274
# built documents.
7375
#
7476
# The short X.Y version.
75-
version = "5.4.0"
77+
version = __version__
7678
# The full version, including alpha/beta/rc tags.
77-
release = "5.4.0"
79+
release = version
7880

7981
autodoc_member_order = "bysource"
8082
autoclass_content = "both"

0 commit comments

Comments
 (0)