File: make-docs.py

package info (click to toggle)
aws-crt-python 0.16.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,328 kB
  • sloc: ansic: 330,743; python: 18,949; makefile: 6,271; sh: 3,712; asm: 754; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (38 lines) | stat: -rwxr-xr-x 893 bytes parent folder | download | duplicates (3)
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()