Skip to content

Commit ba5ab6d

Browse files
Update Sphinx, Theming, and Faster Builds (#1354)
* Fix parallel Sphinx builds when building man output * Don't use vendored theme * Remove vendored theming * Update SphinxBuild.cmake for newer CMake and to use parallel builds * Update Sphinx version * Fix: Documentation version was garbled by debug output * Use the dirhtml builder: Generates "prettier" URLs. To support the old URLs, also generate HTML files that cause a redirect to the new URLs. * Use the "furo" theme.
1 parent c3587f1 commit ba5ab6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+441
-15192
lines changed

.evergreen/scripts/build-docs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ CMAKE=$(find_cmake_latest)
1010
grep "á" NEWS > /dev/null || (echo "NEWS file appears to have lost its UTF-8 encoding?" || exit 1)
1111

1212
debug "Calculating release version..."
13-
python build/calc_release_version.py -d >VERSION_CURRENT
14-
python build/calc_release_version.py -d -p >VERSION_RELEASED
13+
python build/calc_release_version.py >VERSION_CURRENT
14+
python build/calc_release_version.py -p >VERSION_RELEASED
1515

1616
build_dir=$MONGOC_DIR/_build/for-docs
1717
"$CMAKE" -S "$MONGOC_DIR" -B "$build_dir" \

.evergreen/scripts/debian_package_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export DEBOOTSTRAP_DIR=`pwd`/debootstrap.git
4343
sudo -E ./debootstrap.git/debootstrap unstable ./unstable-chroot/ http://cdn-aws.deb.debian.org/debian
4444
cp -a mongoc ./unstable-chroot/tmp/
4545
sudo chroot ./unstable-chroot /bin/bash -c "(\
46-
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx zlib1g-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev && \
46+
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx zlib1g-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev furo && \
4747
chown -R root:root /tmp/mongoc && \
4848
cd /tmp/mongoc && \
4949
git clean -fdx && \

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ CPackSourceConfig.cmake
1919
CTestTestfile.cmake
2020
_build/
2121
dist_manifest.txt
22-
Makefile
2322
test-results.json
2423
VERSION_CURRENT
2524
VERSION_RELEASED

build/cmake/SphinxBuild.cmake

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ function (sphinx_build_html target_name doc_dir)
2121
ProcessorCount (NPROCS)
2222

2323
set (SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
24+
set (doctrees_dir "${SPHINX_HTML_DIR}.doctrees")
2425

25-
file (GLOB doc_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rst)
26-
27-
foreach (rst IN LISTS doc_rsts)
28-
# Every .rst builds a corresponding .html
29-
string (REGEX REPLACE "^([^.]+)\.rst$" "html/\\1.html" html ${rst})
30-
list (APPEND doc_htmls ${html})
31-
endforeach ()
26+
file (GLOB_RECURSE doc_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS *.rst)
27+
# Every .rst builds two corresponding .html files:
28+
list (TRANSFORM doc_rsts
29+
REPLACE "^(.+)\\.rst$" "html/\\1.html;html/\\1/index.html"
30+
OUTPUT_VARIABLE doc_htmls)
3231

3332
# Set PYTHONDONTWRITEBYTECODE to prevent .pyc clutter in the source directory
3433
add_custom_command (OUTPUT ${doc_htmls}
@@ -37,25 +36,22 @@ function (sphinx_build_html target_name doc_dir)
3736
${CMAKE_COMMAND} -E env
3837
"PYTHONDONTWRITEBYTECODE=1"
3938
${SPHINX_EXECUTABLE}
40-
-qEnW -b html
39+
-qnW -b dirhtml
40+
-j "${NPROCS}"
4141
-c "${CMAKE_CURRENT_SOURCE_DIR}"
42+
-d "${doctrees_dir}"
4243
"${CMAKE_CURRENT_SOURCE_DIR}"
4344
"${SPHINX_HTML_DIR}"
44-
COMMAND
45-
rm -rf "${SPHINX_HTML_DIR}/.doctrees" "${SPHINX_HTML_DIR}/.buildinfo"
4645
DEPENDS
4746
${doc_rsts}
4847
COMMENT
4948
"Building HTML documentation with Sphinx"
5049
)
5150

52-
foreach (html IN LISTS doc_htmls)
53-
install (FILES
54-
${CMAKE_CURRENT_BINARY_DIR}/${html}
55-
DESTINATION
56-
${CMAKE_INSTALL_DOCDIR}/${doc_dir}/html
57-
)
58-
endforeach ()
51+
# Install all HTML files
52+
install (DIRECTORY "${SPHINX_HTML_DIR}/"
53+
DESTINATION "${CMAKE_INSTALL_DOCDIR}/${doc_dir}/html"
54+
FILES_MATCHING PATTERN "*.html")
5955

6056
# Ensure additional Sphinx-generated content gets installed
6157
install (FILES
@@ -100,15 +96,17 @@ function (sphinx_build_man target_name)
10096
ProcessorCount (NPROCS)
10197

10298
set (SPHINX_MAN_DIR "${CMAKE_CURRENT_BINARY_DIR}/man")
99+
set (doctrees_dir "${SPHINX_MAN_DIR}.doctrees")
103100

104-
file (GLOB doc_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rst)
101+
file (GLOB_RECURSE doc_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS *.rst)
105102

103+
set (doc_mans)
106104
foreach (rst IN LISTS doc_rsts)
107105
# Only those with the :man_page: tag at the beginning build man pages
108-
file (READ ${rst} rst_head LIMIT 256)
106+
file (READ "${rst}" rst_head LIMIT 256)
109107
string (FIND "${rst_head}" ":man_page: " man_tag_pos)
110-
# GREATER_EQUAL not in CMake until 3.7.
111-
if (NOT man_tag_pos LESS "0")
108+
if (man_tag_pos GREATER_EQUAL "0")
109+
list (APPEND man_doc_rsts "${rst}")
112110
string (REGEX REPLACE
113111
"^.*:man_page: +([a-z0-9_]+).*$" "man\/\\1.3"
114112
man
@@ -124,12 +122,12 @@ function (sphinx_build_man target_name)
124122
${CMAKE_COMMAND} -E env
125123
"PYTHONDONTWRITEBYTECODE=1"
126124
${SPHINX_EXECUTABLE}
127-
-qEW -b man
125+
-qW -b man
126+
-j "${NPROCS}"
128127
-c "${CMAKE_CURRENT_SOURCE_DIR}"
128+
-d "${doctrees_dir}"
129129
"${CMAKE_CURRENT_SOURCE_DIR}"
130130
"${SPHINX_MAN_DIR}"
131-
COMMAND
132-
rm -rf "${SPHINX_MAN_DIR}/.doctrees" "${SPHINX_MAN_DIR}/.buildinfo"
133131
DEPENDS
134132
${doc_rsts}
135133
COMMENT

build/sphinx/basic/changes/frameset.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

build/sphinx/basic/changes/rstsource.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

build/sphinx/basic/changes/versionchanges.html

Lines changed: 0 additions & 33 deletions
This file was deleted.

build/sphinx/basic/defindex.html

Lines changed: 0 additions & 35 deletions
This file was deleted.

build/sphinx/basic/domainindex.html

Lines changed: 0 additions & 56 deletions
This file was deleted.

build/sphinx/basic/genindex-single.html

Lines changed: 0 additions & 63 deletions
This file was deleted.

build/sphinx/basic/genindex-split.html

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)