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 Oct 31, 2023
1 parent 88bc0e4 commit 3745d55
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 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,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):
Expand Down

0 comments on commit 3745d55

Please sign in to comment.