| 1 |
|
| 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 |
|
| 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 |
|
| 25 |
os.chdir('docsrc') |
| 26 |
utils.run('make html SPHINXOPTS="-W --keep-going"') |
| 27 |
utils.chdir_project_root() |
| 28 |
|
| 29 |
|
| 30 |
docs = Path('docs') |
| 31 |
if docs.exists(): |
| 32 |
shutil.rmtree(docs) |
| 33 |
shutil.copytree('docsrc/build/html', docs) |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
Path('docs/.nojekyll').touch() |