|
3 | 3 | # For the full list of built-in configuration values, see the documentation: |
4 | 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
5 | 5 |
|
6 | | -# -- Project information ----------------------------------------------------- |
7 | | -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
| 6 | +import os, sys |
| 7 | +import subprocess |
8 | 8 |
|
| 9 | +on_rtd = os.environ.get("READTHEDOCS") == "True" |
| 10 | + |
| 11 | + |
| 12 | +# -- Generate doxygen xml prior to build -------------------------------------- |
| 13 | + |
| 14 | +# Define the repository URL and target directory |
| 15 | +# |
| 16 | +repo_url = "https://github.com/EXP-code/EXP.git" |
| 17 | +clone_dir = "exp_repo" |
| 18 | +branch = "SLboundaries" |
| 19 | +doxyfile = "exp.cfg.breathe" |
| 20 | +doxy_dir = "doc" |
| 21 | + |
| 22 | +# Cache the current working directory |
| 23 | +# |
| 24 | +build_dir = os.getcwd() |
| 25 | + |
| 26 | +# Clone the EXP repository if it doesn't exist |
| 27 | +# |
| 28 | +if not os.path.exists(clone_dir): |
| 29 | + subprocess.run(["git", "clone", repo_url, clone_dir], check=True) |
| 30 | + |
| 31 | +# Move to source and get the desired branch |
| 32 | +# |
| 33 | +os.chdir(clone_dir) |
| 34 | +subprocess.run(["git", "checkout", branch]) |
| 35 | +subprocess.run(["cp", "CMakeLists.txt", "CMakeLists.txt.orig"]) |
| 36 | +command = ["sed", "-i", "-e", 's/VERSION 3.25/VERSION 3.22/g', "CMakeLists.txt"] |
| 37 | +result = subprocess.run(command, capture_output=True, text=True, check=True) |
| 38 | + |
| 39 | +# Initialize submodules |
| 40 | +# |
| 41 | +os.chdir(doxy_dir) |
| 42 | +os.system("git submodule update --init --recursive") |
| 43 | + |
| 44 | +# Ensure Doxygen is installed and its executable is in your PATH |
| 45 | +# |
| 46 | +subprocess.run(["doxygen", doxyfile], check=True) |
| 47 | + |
| 48 | +if not on_rtd: |
| 49 | + # Build pyEXP to populate Python API documenation |
| 50 | + # |
| 51 | + os.chdir('..') |
| 52 | + |
| 53 | + # Make build directory and begin |
| 54 | + # |
| 55 | + if not os.path.exists('build'): |
| 56 | + subprocess.run(["mkdir", "build"], check=True) |
| 57 | + os.chdir('build') |
| 58 | + subprocess.run(['cmake', '-DCMAKE_BUILD_TYPE=Release -DENABLE_USER=NO -DENABLE_NBODY=NO -DEigen3_DIR=$EIGEN_BASE/share/eigen3/cmake -Wno-dev', '..']) |
| 59 | + subprocess.run(['make', '-j8']) |
| 60 | + |
| 61 | + # Return to top level |
| 62 | + # |
| 63 | + os.chdir(build_dir) |
| 64 | + |
| 65 | + # Add 'my_module_path' to the beginning of sys.path |
| 66 | + # |
| 67 | + my_module_path = os.path.join(build_dir, 'exp_repo/build/pyEXP') |
| 68 | + sys.path.insert(0, my_module_path) |
| 69 | + |
| 70 | +# Begin Sphinx configuration |
| 71 | + |
| 72 | +# -- project information ----------------------------------------------------- |
| 73 | +# |
9 | 74 | project = 'EXP' |
10 | 75 | copyright = '2023-2025, EXP-code collaboration' |
11 | 76 | author = 'EXP-code collaboration' |
12 | | -release = '0.16' |
| 77 | +release = '0.17' |
13 | 78 | version = '7.x' |
14 | 79 |
|
15 | 80 | # -- General configuration --------------------------------------------------- |
|
36 | 101 | templates_path = ['_templates'] |
37 | 102 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.rst'] |
38 | 103 |
|
39 | | -breathe_projects = {"EXP": "doxyxml/"} |
| 104 | +breathe_projects = {"EXP": "exp_repo/doc/xml/"} |
40 | 105 | breathe_default_project = "EXP" |
41 | 106 |
|
42 | 107 | # -- Options for HTML output ------------------------------------------------- |
|
46 | 111 | html_logo = 'exp_logo_white.png' |
47 | 112 | html_static_path = ['_static'] |
48 | 113 |
|
| 114 | +# -- A readthedocs conditional ---------------------------------------------- |
| 115 | +if on_rtd: |
| 116 | + tags.add('rtd') |
| 117 | + |
49 | 118 | # -- Turn on figure numering ------------------------------------------------- |
50 | 119 | numfig = True |
51 | 120 |
|
52 | 121 | # -- Extension configuration ------------------------------------------------- |
53 | 122 | nbsphinx_execute = 'never' |
54 | 123 |
|
55 | 124 | # -- Grab files from pyEXP-examples ----------------------------------------- |
56 | | -import os |
57 | | - |
58 | 125 | 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") |
59 | 126 |
|
0 commit comments