forked from ome/ngff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
79 lines (56 loc) · 2.38 KB
/
conf.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'NGFF'
copyright = '2023, NGFF Community'
author = 'NGFF Community'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ["myst_parser"]
source_suffix = [".rst", ".md"]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.git', '.pytest_cache', '**/.pytest_cache', '**/.tox', 'README.md', 'LICENSE.md', 'CONTRIBUTING.md']
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
html_css_files = [
'https://cdn.datatables.net/v/dt/dt-1.11.5/datatables.min.css',
]
html_js_files = [
'https://cdn.datatables.net/v/dt/dt-1.11.5/datatables.min.js',
'main.js',
]
html_extra_path = [
'_bikeshed',
]
# ####################################
# Run bikeshed build
# ####################################
def bikeshed():
import glob
import os
import shutil
import subprocess
for index_file in ["latest/index.bs"] + glob.glob("[0-9]*/index.bs"):
output_file = index_file.replace("bs", "html")
output_dir = os.path.dirname(output_file)
target_dir = os.path.join("_bikeshed", output_dir)
run_bikeshed = True
# Give the loop a chance to skip files if no build is needed/requested
if "BIKESHED" not in os.environ and os.path.exists(output_file):
src_time = os.path.getmtime(index_file)
out_time = os.path.getmtime(output_file)
if src_time < out_time:
print(f"{index_file} unchanged")
run_bikeshed = False
if run_bikeshed:
subprocess.check_call(f"bikeshed spec {index_file} {output_file}", shell=True)
if os.path.exists(target_dir):
shutil.rmtree(target_dir)
shutil.copytree(output_dir, target_dir)
bikeshed()
del bikeshed