Skip to content

Commit 1eadfde

Browse files
committed
Add option to treat sphinx warnings as errors
1 parent 94f91c2 commit 1eadfde

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/make.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def html(buildername='html'):
4343
options = "-D plot_formats=\"[('png', 80)]\""
4444
else:
4545
options = ''
46+
if warnings_as_errors:
47+
options = options + ' -W'
4648
if os.system('sphinx-build %s -b %s -d build/doctrees . build/%s' % (options, buildername, buildername)):
4749
raise SystemExit("Building HTML failed.")
4850

@@ -136,6 +138,7 @@ def all():
136138

137139

138140
small_docs = False
141+
warnings_as_errors = False
139142

140143
# Change directory to the one containing this file
141144
current_dir = os.getcwd()
@@ -180,9 +183,14 @@ def all():
180183
parser.add_argument("--small",
181184
help="Smaller docs with only low res png figures",
182185
action="store_true")
186+
parser.add_argument("--warningsaserrors",
187+
help="Turn Sphinx warnings into errors",
188+
action="store_true")
183189
args = parser.parse_args()
184190
if args.small:
185191
small_docs = True
192+
if args.warningsaserrors:
193+
warnings_as_errors = True
186194

187195
if args.cmd:
188196
for command in args.cmd:

0 commit comments

Comments
 (0)