Skip to content

Commit

Permalink
Use direct call to sphinx build for faster build
Browse files Browse the repository at this point in the history
  • Loading branch information
khancyr committed Nov 2, 2023
1 parent 93c7342 commit 92f7107
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import sys
import time

from sphinx.application import Sphinx
import rst_table

from codecs import open
Expand Down Expand Up @@ -193,17 +194,21 @@ 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(srcdir=source_dir, confdir=source_dir, outdir=html_dir, doctreedir=doctree_dir, buildername='html',
parallel=2)
app.build()


def sphinx_make(site, parallel, fast):
Expand Down

0 comments on commit 92f7107

Please sign in to comment.