Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f28212

Browse files
committed
changes in building the documentation
1 parent 0984694 commit 9f28212

File tree

2 files changed

+87
-11
lines changed

2 files changed

+87
-11
lines changed

doc/devel/documenting_mpl.rst

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,18 @@ Other useful invocations include
7272

7373
.. code-block:: sh
7474
75-
# Delete built files. May help if you get errors about missing paths or
76-
# broken links.
75+
# Delete built files. May help if you get errors about
76+
# missing paths or broken links.
7777
make clean
7878
7979
# Build pdf docs.
8080
make latexpdf
8181
82+
Linux, macOS
83+
~~~~~
84+
The documentation is built using the ``Makefile`` file and parameters
85+
can be set either in the ``Makefile`` or on the command line.
86+
8287
The ``SPHINXOPTS`` variable is set to ``-W`` by default to turn warnings into
8388
errors. To unset it, use
8489

@@ -88,16 +93,85 @@ errors. To unset it, use
8893
8994
You can use the ``O`` variable to set additional options:
9095

91-
* ``make O=-j4 html`` runs a parallel build with 4 processes.
92-
* ``make O=-Dplot_formats=png:100 html`` saves figures in low resolution.
93-
* ``make O=-Dplot_gallery=0 html`` skips the gallery build.
96+
.. code-block:: sh
97+
98+
#runs a parallel build with 4 processes.
99+
make O=-j4 html
100+
101+
#saves figures in low resolution.
102+
make O=-Dplot_formats=png:100 html
103+
104+
#builds the gallery without executing the scripts
105+
make O=-Dplot_gallery=0 html
106+
107+
#Multiple options can be combined using e.g.
108+
make O='-j4 -Dplot_gallery=0' html
109+
110+
Windows
111+
~~~~~~~
112+
.. note::
113+
114+
It is currently not possible to build the gallery on windows due to a
115+
problem in sphinx-gallery that should be fixed in version 0.1.14. A
116+
workaround is to not build the gallery by commenting out
117+
``sphinx_gallery.gen_gallery`` in ``extensions`` in the ``conf.py`` file
118+
or to delete the code in or delete the
119+
``examples\userdemo\pgf_preamble_sgskip.py`` file.
120+
121+
The documentation is build using the ``make.bat`` file. The options are set using
122+
environment variables and varibales can be set either in the
123+
``make.bat`` file or set on the command line befor running ``make.bat``.
124+
125+
Environment variables are set with
126+
127+
.. code-block:: sh
128+
129+
#in cmd
130+
set SPHINXOPTS=-W
131+
set O=-Dplot_gallery=0
132+
133+
#in powershell
134+
Set-Item env:SPHINXOPTS "-W"
135+
Set-Item env:O "-Dplot_gallery=0"
94136
95-
Multiple options can be combined using e.g. ``make O='-j4 -Dplot_gallery=0'
96-
html``.
137+
Set ``SPHINXOPTS`` to ``-W`` to turn warnings into errors.
138+
139+
You can use the ``O`` variable to set additional options, for example (see
140+
linux, macOS above for more options)
97141

98-
On Windows, options needs to be set as environment variables, e.g. ``set O=-W
99-
-j4 & make html``.
142+
.. code-block:: sh
143+
144+
set O=-j4 -Dplot_gallery=0
145+
146+
The total command is then run with
147+
148+
.. code-block:: sh
149+
150+
#in cmd
151+
set O=-Dplot_gallery=0
152+
make html
153+
154+
#or on one line
155+
set O=-Dplot_gallery=0 & make html
156+
157+
#in powershell
158+
Set-Item env:O "-Dplot_gallery=0"
159+
.\make html
160+
161+
#or on one line
162+
Set-Item env:O "-Dplot_gallery=0"; .\make html
163+
164+
There is no difference between the variables ``SPHINXOPTS`` and ``O`` and both
165+
are unset at the end of the ``make.bat`` file if cmd is used but not if
166+
powershell is used. So a variable must be unset manually with
167+
168+
.. code-block:: sh
100169
170+
Set-Item evn:O
171+
172+
in powershell before running ``make.bat`` again if the default behavior is
173+
wanted.
174+
101175
.. _writing-rest-pages:
102176

103177
Writing ReST pages

doc/make.bat

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ if "%SPHINXBUILD%" == "" (
1010
set SOURCEDIR=.
1111
set BUILDDIR=build
1212
set SPHINXPROJ=matplotlib
13-
set SPHINXOPTS=-W
14-
set O=
1513

1614
%SPHINXBUILD% >NUL 2>NUL
1715
if errorlevel 9009 (
@@ -28,11 +26,15 @@ if errorlevel 9009 (
2826

2927
if "%1" == "" goto help
3028

29+
echo %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3130
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3231
goto end
3332

3433
:help
34+
3535
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3636

3737
:end
38+
set O=
39+
set SPHINXOPTS=
3840
popd

0 commit comments

Comments
 (0)