From de3ace33648f9964a167077c09d5ddfb78d55593 Mon Sep 17 00:00:00 2001 From: Stephen Copplestone Date: Mon, 30 Oct 2023 11:54:21 +0100 Subject: [PATCH] Added prerequisites checks for the HTML and PDF building scripts + info where the output files are created and how to view them. --- docs/documentation/buildHTML.sh | 17 +++++++++++++++-- docs/documentation/buildPDF.sh | 25 +++++++++++++++++++------ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/docs/documentation/buildHTML.sh b/docs/documentation/buildHTML.sh index 05d0a4359..e5c94b2bb 100755 --- a/docs/documentation/buildHTML.sh +++ b/docs/documentation/buildHTML.sh @@ -1,2 +1,15 @@ -# Compile html files -python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html +#!/bin/bash + +# Check prerequisites +python3 -c "import sphinx" + +# $? Stores the exit value of the last command that was executed. +if [[ $? -eq 0 ]]; then + # Compile html files + python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html + + # Output info where the html file is + echo -e "\nThe HTML files have been created. Run, e.g., 'firefox _build/html/index.html &' to view the documentation." +else + echo -e "\nError: Could not build the documentation due to import errors in python! Fix them and run the script again." +fi diff --git a/docs/documentation/buildPDF.sh b/docs/documentation/buildPDF.sh index 83fa5e77b..302088238 100755 --- a/docs/documentation/buildPDF.sh +++ b/docs/documentation/buildPDF.sh @@ -1,8 +1,21 @@ -# Compile latex files -python3 -m sphinx -b latex -D language=en -d _build/doctrees . _build/latex +#!/bin/bash -# Switch to latex source files -cd _build/latex +# Check prerequisites +python3 -c "import sphinx" -# Compile pdf file(s) -latexmk -r latexmkrc -pdf -f -dvi- -ps- -jobname=piclas -interaction=nonstopmode +# $? Stores the exit value of the last command that was executed. +if [[ $? -eq 0 ]]; then + # Compile latex files + python3 -m sphinx -b latex -D language=en -d _build/doctrees . _build/latex + + # Switch to latex source files + cd _build/latex + + # Compile pdf file(s) + latexmk -r latexmkrc -pdf -f -dvi- -ps- -jobname=piclas -interaction=nonstopmode + + # Output info where the pdf file is + echo -e "\n The PDF has been created under ./_build/latex/piclas.pdf" +else + echo -e "\nError: Could not build the documentation due to import errors in python! Fix them and run the script again." +fi