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
|
#!/usr/bin/env python3
import argparse
import os.path
from pathlib import Path
import shutil
import utils
parser = argparse.ArgumentParser()
parser.add_argument('--skip-clean', action='store_true', help="Iterate faster by skipping the clean step")
args = parser.parse_args()
utils.chdir_project_root()
# clean
if not args.skip_clean:
docs = Path('docs')
if docs.exists():
shutil.rmtree(docs)
build = Path('docsrc/build')
if build.exists():
shutil.rmtree(build)
# build
os.chdir('docsrc')
utils.run('make html SPHINXOPTS="-W --keep-going"')
utils.chdir_project_root()
# copy
docs = Path('docs')
if docs.exists():
shutil.rmtree(docs)
shutil.copytree('docsrc/build/html', docs)
# The existence of this file tells GitHub Pages to just host the HTML as-is
# https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
Path('docs/.nojekyll').touch()
|