-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconf.py
More file actions
126 lines (98 loc) · 3.84 KB
/
conf.py
File metadata and controls
126 lines (98 loc) · 3.84 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# 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
import os, sys
import subprocess
on_rtd = os.environ.get("READTHEDOCS") == "True"
# -- Generate doxygen xml prior to build --------------------------------------
# Define the repository URL and target directory
#
repo_url = "https://github.com/EXP-code/EXP.git"
clone_dir = "exp_repo"
branch = "SLboundaries"
doxyfile = "exp.cfg.breathe"
doxy_dir = "doc"
# Cache the current working directory
#
build_dir = os.getcwd()
# Clone the EXP repository if it doesn't exist
#
if not os.path.exists(clone_dir):
subprocess.run(["git", "clone", repo_url, clone_dir], check=True)
# Move to source and get the desired branch
#
os.chdir(clone_dir)
subprocess.run(["git", "checkout", branch])
subprocess.run(["cp", "CMakeLists.txt", "CMakeLists.txt.orig"])
command = ["sed", "-i", "-e", 's/VERSION 3.25/VERSION 3.22/g', "CMakeLists.txt"]
result = subprocess.run(command, capture_output=True, text=True, check=True)
# Initialize submodules
#
os.chdir(doxy_dir)
os.system("git submodule update --init --recursive")
# Ensure Doxygen is installed and its executable is in your PATH
#
subprocess.run(["doxygen", doxyfile], check=True)
if not on_rtd:
# Build pyEXP to populate Python API documenation
#
os.chdir('..')
# Make build directory and begin
#
if not os.path.exists('build'):
subprocess.run(["mkdir", "build"], check=True)
os.chdir('build')
subprocess.run(['cmake', '-DCMAKE_BUILD_TYPE=Release -DENABLE_USER=NO -DENABLE_NBODY=NO -DEigen3_DIR=$EIGEN_BASE/share/eigen3/cmake -Wno-dev', '..'])
subprocess.run(['make', '-j8'])
# Return to top level
#
os.chdir(build_dir)
# Add 'my_module_path' to the beginning of sys.path
#
my_module_path = os.path.join(build_dir, 'exp_repo/build/pyEXP')
sys.path.insert(0, my_module_path)
# Begin Sphinx configuration
# -- project information -----------------------------------------------------
#
project = 'EXP'
copyright = '2023-2025, EXP-code collaboration'
author = 'EXP-code collaboration'
release = '0.172'
version = '7.x'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'sphinx_rtd_theme',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.graphviz',
'breathe',
'sphinx_copybutton',
'nbsphinx',
'nbsphinx_link'
]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.rst']
breathe_projects = {"EXP": "exp_repo/doc/xml/"}
breathe_default_project = "EXP"
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_rtd_theme'
html_logo = 'exp_logo_white.png'
html_static_path = ['_static']
# -- A readthedocs conditional ----------------------------------------------
if on_rtd:
tags.add('rtd')
# -- Turn on figure numering -------------------------------------------------
numfig = True
# -- Extension configuration -------------------------------------------------
nbsphinx_execute = 'never'
# -- Grab files from pyEXP-examples -----------------------------------------
os.system("cd intro/Tutorials; rm *ipynb*; wget -L https://raw.githubusercontent.com/EXP-code/pyEXP-examples/refs/heads/main/Tutorials/Introduction/Part1-Coefficients.ipynb; wget -L https://raw.githubusercontent.com/EXP-code/pyEXP-examples/refs/heads/main/Tutorials/Introduction/Part2-Analysis.ipynb")