Skip to content

Commit bfd91b4

Browse files
committed
Put in a hotfix for an issue that prevented the one sanity check this site has for validating that the website will work properly
1 parent b9d9085 commit bfd91b4

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

Diff for: Makefile

+43-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
99

10+
CURRENT_DOC_DIR = ./static_root/doc
11+
TEMP_TEST_DOC_DIR = ./doc
12+
1013
# User-friendly check for sphinx-build
1114
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
1215
$(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/)
@@ -166,7 +169,46 @@ changes:
166169
@echo "The overview file is in $(BUILDDIR)/changes."
167170

168171
linkcheck:
169-
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
172+
# For some reason, the doc directory for our sources is set to
173+
# ./static_root/doc but Sphinx expects it to be at ./doc and this has yet to
174+
# be addressed. The effect of this discontinuity is that when Sphinx is
175+
# running, it looks in the incorrect location with relative paths for static
176+
# files we are serving up. This ultimately is not an issue for the
177+
# functionality of the website as the links are indeed consistent in the
178+
# static files generated, but it causes tests such as `linkcheck` to fail.
179+
# For this reason, this make command has been modified to accoun for this
180+
# discontinuity to preserve the validity of the test, but this change may
181+
# have impact on future modifications to the website's internal structure
182+
# and/or a fix for this issue, hence the in-line documentation of the problem
183+
# (which gets printed to the console upon `linkcheck`'s failure).
184+
#
185+
# Here's what the make command was prior to this modification (and likely
186+
# should be converted back to after addressing the issue):
187+
#
188+
# $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
189+
# @echo
190+
# @echo "Link check complete; look for any errors in the above output " \
191+
# "or in $(BUILDDIR)/linkcheck/output.txt."
192+
#
193+
# Here's an overview of the logic for circumventing the issue:
194+
#
195+
# (1) Attempt to create the symlink to the actual doc directory in the
196+
# location that Sphinx expects it to be.
197+
# => Success
198+
# (a) Run linkcheck as we've properly configured our local structure
199+
# to be what Sphinx expects.
200+
# (b) Delete the symlink hack/patch, regardless of `linkcheck`'s
201+
# success as we know we create ./doc as a symlink in (1) (as
202+
# opposed to it being a directory containing its own data
203+
# possibly created at a later time without knowledge of this
204+
# fix).
205+
# => Failure
206+
# (a) Do no proceed and let this message be printed for future
207+
# debugging/maintainance effors.
208+
test -h $(TEMP_TEST_DOC_DIR) \
209+
|| ln -sT $(CURRENT_DOC_DIR) $(TEMP_TEST_DOC_DIR) \
210+
&& $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck \
211+
; rm $(TEMP_TEST_DOC_DIR)
170212
@echo
171213
@echo "Link check complete; look for any errors in the above output " \
172214
"or in $(BUILDDIR)/linkcheck/output.txt."

0 commit comments

Comments
 (0)