Debian Codegraph @

scripts/make-docs.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 import argparse
3 import os.path
4 from pathlib import Path
5 import shutil
6 import utils
7
8
9 parser = argparse.ArgumentParser()
10 parser.add_argument('--skip-clean', action='store_true', help="Iterate faster by skipping the clean step")
11 args = parser.parse_args()
12
13 utils.chdir_project_root()
14
15 # clean
16 if not args.skip_clean:
17 docs = Path('docs')
18 if docs.exists():
19 shutil.rmtree(docs)
20 build = Path('docsrc/build')
21 if build.exists():
22 shutil.rmtree(build)
23
24 # build
25 os.chdir('docsrc')
26 utils.run('make html SPHINXOPTS="-W --keep-going"')
27 utils.chdir_project_root()
28
29 # copy
30 docs = Path('docs')
31 if docs.exists():
32 shutil.rmtree(docs)
33 shutil.copytree('docsrc/build/html', docs)
34
35
36 # The existence of this file tells GitHub Pages to just host the HTML as-is
37 # https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
38 Path('docs/.nojekyll').touch()