@@ -7,18 +7,25 @@ SPHINXBUILD ?= sphinx-build
7
7
PAPER =
8
8
BUILDDIR = _build
9
9
10
- # Run sequential by default, unless SPHINX_NUMJOBS is set.
11
- SPHINX_NUMJOBS ?= 1
12
-
13
10
ifneq ($(EXAMPLES_PATTERN ) ,)
14
11
EXAMPLES_PATTERN_OPTS := -D sphinx_gallery_conf.filename_pattern="$(EXAMPLES_PATTERN ) "
15
12
endif
16
13
14
+ ifeq ($(CI ) , true)
15
+ # On CircleCI using -j2 does not seem to speed up the html-noplot build
16
+ SPHINX_NUMJOBS_NOPLOT_DEFAULT =1
17
+ else ($(shell uname), Darwin)
18
+ # Avoid stalling issues on MacOS
19
+ SPHINX_NUMJOBS_NOPLOT_DEFAULT =1
20
+ else
21
+ SPHINX_NUMJOBS_NOPLOT_DEFAULT =auto
22
+ endif
23
+
17
24
# Internal variables.
18
25
PAPEROPT_a4 = -D latex_paper_size=a4
19
26
PAPEROPT_letter = -D latex_paper_size=letter
20
27
ALLSPHINXOPTS = -T -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) \
21
- -j $( SPHINX_NUMJOBS ) $(EXAMPLES_PATTERN_OPTS ) .
28
+ $(EXAMPLES_PATTERN_OPTS ) .
22
29
23
30
24
31
.PHONY : help clean html dirhtml ziphtml pickle json latex latexpdf changes linkcheck doctest optipng
@@ -44,17 +51,27 @@ clean:
44
51
-rm -rf generated/*
45
52
-rm -rf modules/generated/
46
53
54
+ # Default to SPHINX_NUMJOBS=1 for full documentation build. Using
55
+ # SPHINX_NUMJOBS!=1 may actually slow down the build, or cause weird issues in
56
+ # the CI (job stalling or EOFError), see
57
+ # https://github.com/scikit-learn/scikit-learn/pull/25836 or
58
+ # https://github.com/scikit-learn/scikit-learn/pull/25809
59
+ html : SPHINX_NUMJOBS ?= 1
47
60
html :
48
61
# These two lines make the build a bit more lengthy, and the
49
62
# the embedding of images more robust
50
63
rm -rf $(BUILDDIR ) /html/_images
51
64
# rm -rf _build/doctrees/
52
- $(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html/stable
65
+ $(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) -j $( SPHINX_NUMJOBS ) $(BUILDDIR ) /html/stable
53
66
@echo
54
67
@echo " Build finished. The HTML pages are in $( BUILDDIR) /html/stable"
55
68
69
+ # Default to SPHINX_NUMJOBS=auto (except on MacOS and CI) since this makes
70
+ # html-noplot build faster
71
+ html-noplot : SPHINX_NUMJOBS ?= $(SPHINX_NUMJOBS_NOPLOT_DEFAULT )
56
72
html-noplot :
57
- $(SPHINXBUILD ) -D plot_gallery=0 -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html/stable
73
+ $(SPHINXBUILD ) -D plot_gallery=0 -b html $(ALLSPHINXOPTS ) -j$(SPHINX_NUMJOBS ) \
74
+ $(BUILDDIR)/html/stable
58
75
@echo
59
76
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/stable."
60
77
0 commit comments