From 3745d55a060cbe618fa2bf3d9b40814d60cb66d1 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Tue, 31 Oct 2023 22:50:50 +0100 Subject: [PATCH] Use direct call to sphinx build for faster build --- update.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/update.py b/update.py index 8fd4d8638e..74a9e029b7 100755 --- a/update.py +++ b/update.py @@ -47,6 +47,7 @@ import sys import time +from sphinx.application import Sphinx import rst_table from codecs import open @@ -193,17 +194,20 @@ def fetchlogmessages(site=None, cache=None): def build_one(wiki, fast): - '''build one wiki''' - debug('Using make for sphinx: %s' % wiki) - if platform.system() == "Windows": - # This will fail if there's no folder to clean, so no check_call here - if not fast: - subprocess.run(["make.bat", "clean"], cwd=wiki, shell=True) - subprocess.check_call(["make.bat", "html"], cwd=wiki, shell=True) - else: - if not fast: - subprocess.check_call(["nice", "make", "clean"], cwd=wiki) - subprocess.check_call(["nice", "make", "html"], cwd=wiki) + """build one wiki""" + print('Using sphinx-build for sphinx: %s' % wiki) + + source_dir = os.path.join(wiki, 'source') + output_dir = os.path.join(wiki, 'build') + html_dir = os.path.join(output_dir, 'html') + doctree_dir = os.path.join(output_dir, 'doctrees') + + # This will fail if there's no folder to clean, so we check first + if not fast and os.path.exists(output_dir): + shutil.rmtree(output_dir) + + app = Sphinx(source_dir, source_dir, html_dir, doctree_dir, 'html', parallel=2) + app.build() def sphinx_make(site, parallel, fast):