Skip to content

Commit 0ce318e

Browse files
committed
chore: mkdoc.sh script reformatted, output is less verbose now
1 parent 9607fd6 commit 0ce318e

File tree

1 file changed

+46
-45
lines changed

1 file changed

+46
-45
lines changed

scripts/mkdoc.sh

+46-45
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@ CLEAN=0
1717

1818
while getopts ":scjdl" OPTION; do
1919
case $OPTION in
20-
c)
21-
CLEAN=1
22-
;;
23-
d)
24-
DOC2DASH=1
25-
;;
26-
l)
27-
LINKCHECK=1
28-
;;
29-
\?)
30-
echo "Usage: $0 [-sjd]"
31-
exit 1
32-
;;
33-
esac
20+
c)
21+
CLEAN=1
22+
;;
23+
d)
24+
DOC2DASH=1
25+
;;
26+
l)
27+
LINKCHECK=1
28+
;;
29+
\?)
30+
echo "Usage: $0 [-sjd]"
31+
exit 1
32+
;;
33+
esac
3434
done
35-
shift $((OPTIND -1))
35+
shift $((OPTIND - 1))
3636

37-
SCRIPTS_FOLDER=`dirname $0`
37+
SCRIPTS_FOLDER=$(dirname $0)
3838

3939
cd ${SCRIPTS_FOLDER}/..
40-
ROOT_FOLDER=`pwd`
40+
ROOT_FOLDER=$(pwd)
4141
DOC_SOURCE_FOLDER=${ROOT_FOLDER}/doc/source
4242
DOC_HTML_FOLDER=${ROOT_FOLDER}/doc/html
4343
DOC_LINKCHECK_FOLDER=${ROOT_FOLDER}/doc/linkcheck
@@ -51,17 +51,20 @@ if [ ! -d ".venv" ]; then
5151

5252
# Install sphinx, matplotlib, pandas, scipy, wheel and pydoctor into the venv.
5353
# doc2dash is optional; it will be installed when -d is given
54-
.venv/bin/pip install -U pip wheel sphinx==7.4.7 matplotlib pandas scipy pydoctor sphinx-rtd-theme
54+
.venv/bin/pip install -q -U pip wheel sphinx==7.4.7 matplotlib pandas scipy pydoctor sphinx-rtd-theme
55+
else
56+
# Upgrade pip in the virtualenv
57+
.venv/bin/pip install -q -U pip wheel
5558
fi
5659

5760
# Make sure that Sphinx, PyDoctor (and maybe doc2dash) are up-to-date in the virtualenv
58-
.venv/bin/pip install -U sphinx==7.4.7 pydoctor sphinx-gallery sphinxcontrib-jquery sphinx-rtd-theme
61+
.venv/bin/pip install -q -U sphinx==7.4.7 pydoctor sphinx-gallery sphinxcontrib-jquery sphinx-rtd-theme
5962
if [ x$DOC2DASH = x1 ]; then
60-
.venv/bin/pip install -U doc2dash
63+
.venv/bin/pip install -U doc2dash
6164
fi
6265

6366
echo "Removing existing igraph and python-igraph eggs from virtualenv..."
64-
SITE_PACKAGES_DIR=`.venv/bin/python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'`
67+
SITE_PACKAGES_DIR=$(.venv/bin/python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
6568
rm -rf "${SITE_PACKAGES_DIR}"/igraph*.egg
6669
rm -rf "${SITE_PACKAGES_DIR}"/igraph*.egg-link
6770
rm -rf "${SITE_PACKAGES_DIR}"/python_igraph*.egg
@@ -84,49 +87,47 @@ fi
8487
if [ "x$LINKCHECK" = "x1" ]; then
8588
echo "Check for broken links"
8689
.venv/bin/python -m sphinx \
87-
-T \
88-
-b linkcheck \
89-
-Dtemplates_path='' \
90-
-Dhtml_theme='alabaster' \
91-
${DOC_SOURCE_FOLDER} ${DOC_LINKCHECK_FOLDER}
90+
-T \
91+
-b linkcheck \
92+
-Dtemplates_path='' \
93+
-Dhtml_theme='alabaster' \
94+
${DOC_SOURCE_FOLDER} ${DOC_LINKCHECK_FOLDER}
9295
fi
9396

94-
9597
echo "Generating HTML documentation..."
96-
.venv/bin/pip install -U sphinx-rtd-theme
98+
.venv/bin/pip install -q -U sphinx-rtd-theme
9799
.venv/bin/python -m sphinx -T -b html ${DOC_SOURCE_FOLDER} ${DOC_HTML_FOLDER}
98100

99101
echo "HTML documentation generated in ${DOC_HTML_FOLDER}"
100102

101-
102103
# doc2dash
103104
if [ "x$DOC2DASH" = "x1" ]; then
104-
PWD=`pwd`
105+
PWD=$(pwd)
105106
# Output folder of sphinx (before Jekyll if requested)
106107
DOC_API_FOLDER=${ROOT_FOLDER}/doc/html/api
107108
DOC2DASH=.venv/bin/doc2dash
108109
DASH_FOLDER=${ROOT_FOLDER}/doc/dash
109110
if [ "x$DOC2DASH" != x ]; then
110-
echo "Generating Dash docset..."
111-
"$DOC2DASH" \
112-
--online-redirect-url "https://python.igraph.org/en/latest/api/" \
113-
--name "python-igraph" \
114-
-d "${DASH_FOLDER}" \
115-
-f \
116-
-j \
117-
-I "index.html" \
118-
--icon ${ROOT_FOLDER}/doc/source/icon.png \
119-
--icon-2x ${ROOT_FOLDER}/doc/source/icon@2x.png \
120-
"${DOC_API_FOLDER}"
121-
DASH_READY=1
111+
echo "Generating Dash docset..."
112+
"$DOC2DASH" \
113+
--online-redirect-url "https://python.igraph.org/en/latest/api/" \
114+
--name "python-igraph" \
115+
-d "${DASH_FOLDER}" \
116+
-f \
117+
-j \
118+
-I "index.html" \
119+
--icon ${ROOT_FOLDER}/doc/source/icon.png \
120+
--icon-2x ${ROOT_FOLDER}/doc/source/icon@2x.png \
121+
"${DOC_API_FOLDER}"
122+
DASH_READY=1
122123
else
123-
echo "WARNING: doc2dash not installed, skipping Dash docset generation."
124-
DASH_READY=0
124+
echo "WARNING: doc2dash not installed, skipping Dash docset generation."
125+
DASH_READY=0
125126
fi
126127

127128
echo ""
128129
if [ "x${DASH_READY}" = x1 ]; then
129-
echo "Dash docset generated in ${DASH_FOLDER}/python-igraph.docset"
130+
echo "Dash docset generated in ${DASH_FOLDER}/python-igraph.docset"
130131
fi
131132

132133
cd "$PWD"

0 commit comments

Comments
 (0)