forked from igraph/python-igraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkdoc.sh
More file actions
executable file
·75 lines (59 loc) · 2.03 KB
/
Copy pathmkdoc.sh
File metadata and controls
executable file
·75 lines (59 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
#
# Creates the API documentation for igraph's Python interface using PyDoctor
#
# Usage: ./mkdoc.sh
SCRIPTS_FOLDER=`dirname $0`
cd ${SCRIPTS_FOLDER}/..
ROOT_FOLDER=`pwd`
DOC_API_FOLDER=${ROOT_FOLDER}/doc/api
cd ${ROOT_FOLDER}
if [ ! -d ".venv" ]; then
# Create a virtual environment for pydoctor
python3 -m venv .venv
.venv/bin/pip install -U pydoctor wheel
fi
PYDOCTOR=.venv/bin/pydoctor
if [ ! -f ${PYDOCTOR} ]; then
echo "PyDoctor not installed in the virtualenv of the project, exiting..."
exit 1
fi
PWD=`pwd`
echo "Removing existing documentation..."
rm -rf "${DOC_API_FOLDER}/html" "${DOC_API_FOLDER}/pdf"
echo "Removing existing python-igraph eggs from virtualenv..."
SITE_PACKAGES_DIR=`.venv/bin/python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'`
rm -rf "${SITE_PACKAGES_DIR}"/python_igraph*.egg
rm -rf "${SITE_PACKAGES_DIR}"/python_igraph*.egg-link
echo "Installing python-igraph in virtualenv..."
rm -f dist/*.whl && .venv/bin/python setup.py bdist_wheel && .venv/bin/pip install --force-reinstall dist/*.whl
IGRAPHDIR=`.venv/bin/python3 -c 'import igraph, os; print(os.path.dirname(igraph.__file__))'`
echo "Generating HTML documentation..."
"$PYDOCTOR" \
--project-name "python-igraph" \
--project-url "https://igraph.org/python" \
--introspect-c-modules \
--make-html \
--html-output "${DOC_API_FOLDER}/html" \
${IGRAPHDIR}
# PDF not supported by PyDoctor
DOC2DASH=`which doc2dash 2>/dev/null || true`
if [ "x$DOC2DASH" != x ]; then
echo "Generating Dash docset..."
"$DOC2DASH" \
--online-redirect-url "https://igraph.org/python/doc/api" \
--name "python-igraph" \
-d "${DOC_API_FOLDER}" \
-f \
"${DOC_API_FOLDER}/html"
DASH_READY=1
else
echo "WARNING: doc2dash not installed, skipping Dash docset generation."
DASH_READY=0
fi
echo ""
echo "HTML API documentation generated in ${DOC_API_FOLDER}/html"
if [ "x${DASH_READY}" = x1 ]; then
echo "Dash docset generated in ${DOC_API_FOLDER}/python-igraph.docset"
fi
cd "$PWD"