Skip to content

Commit 79fbfa6

Browse files
author
Petr Vesely
committed
[UR] Fix documentation build script
1 parent d6c3bd1 commit 79fbfa6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

scripts/generate_docs.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,12 @@ def generate_html(dstpath):
245245
sourcepath = os.path.join(dstpath, "source")
246246

247247
print("Generating HTML...")
248-
cmdline = "sphinx-build -M html %s ../docs"%sourcepath
249-
print(cmdline)
250-
os.system(cmdline)
248+
result = subprocess.run(["sphinx-build", "-M", "html", sourcepath, "../docs" ], stderr=subprocess.PIPE)
249+
if result.returncode != 0:
250+
print("sphinx-build returned non-zero error code.")
251+
print("--- output ---")
252+
print(result.stderr.read().decode())
253+
raise Exception("Failed to generate html documentation.")
251254

252255
"""
253256
Entry-point:
@@ -257,9 +260,12 @@ def generate_pdf(dstpath):
257260
sourcepath = os.path.join(dstpath, "source")
258261

259262
print("Generating PDF...")
260-
cmdline = "sphinx-build -b pdf %s ../docs/latex"%sourcepath
261-
print(cmdline)
262-
os.system(cmdline)
263+
result = subprocess.run(["sphinx-build", "-b", "pdf", sourcepath, "../docs/latex"], stderr=subprocess.PIPE)
264+
if result.returncode != 0:
265+
print("sphinx-build returned non-zero error code.")
266+
print("--- output ---")
267+
print(result.stderr.read().decode())
268+
raise Exception("Failed to generate pdf documentation.")
263269

264270
"""
265271
Entry-point:

0 commit comments

Comments
 (0)