|
| 1 | +# ruff: noqa: E402 |
1 | 2 | # Configuration file for the Sphinx documentation builder. |
2 | 3 | # |
3 | 4 | # This file only contains a selection of the most common options. For a full |
|
14 | 15 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
15 | 16 | # |
16 | 17 | import sys |
17 | | -from subprocess import Popen, PIPE |
| 18 | +from subprocess import PIPE, Popen |
18 | 19 |
|
19 | 20 | sys.path.insert(0, os.path.abspath(os.path.join("..", "doc"))) |
20 | 21 | sys.path.insert(0, os.path.abspath(os.path.join("..", "distribution"))) |
|
23 | 24 | on_rtd = os.environ.get("READTHEDOCS") == "True" |
24 | 25 |
|
25 | 26 | # -- print current directory |
26 | | -print("Current Directory...'{}'".format(os.path.abspath(os.getcwd()))) |
| 27 | +print(f"Current Directory...'{os.path.abspath(os.getcwd())}'") |
27 | 28 |
|
28 | 29 | # -- clean up doxygen files ------------------------------------------------- |
29 | 30 | dox_pths = ("_mf6io",) |
30 | 31 | for dox_pth in dox_pths: |
31 | | - print("cleaning....{}".format(dox_pth)) |
| 32 | + print(f"cleaning....{dox_pth}") |
32 | 33 | for root, dirs, files in os.walk(dox_pth): |
33 | 34 | for name in files: |
34 | 35 | fpth = os.path.join(root, name) |
|
37 | 38 | # -- Update the modflow 6 version ------------------------------------------- |
38 | 39 | print("Update the modflow6 version") |
39 | 40 | from update_version import update_version |
| 41 | + |
40 | 42 | update_version() |
41 | 43 |
|
42 | 44 | # -- import version from doc/version.py ------------------------------------- |
|
56 | 58 | # copy the file |
57 | 59 | shutil.copy(src, dst) |
58 | 60 |
|
| 61 | +# -- copy developer docs |
| 62 | +dstdir = "_dev" |
| 63 | +fpth = "DEVELOPER.md" |
| 64 | +src = os.path.join("..", fpth) |
| 65 | +dst = os.path.join(dstdir, fpth.lower()) |
| 66 | +# clean up an existing _mf6run directory |
| 67 | +if os.path.isdir(dstdir): |
| 68 | + shutil.rmtree(dstdir) |
| 69 | +# make the directory |
| 70 | +os.makedirs(dstdir) |
| 71 | +# copy the file |
| 72 | +shutil.copy(src, dst) |
| 73 | + |
| 74 | +# -- copy contributor docs |
| 75 | +fpth = "CONTRIBUTING.md" |
| 76 | +src = os.path.join("..", fpth) |
| 77 | +dst = os.path.join(dstdir, fpth.lower()) |
| 78 | +shutil.copy(src, dst) |
| 79 | + |
| 80 | +# -- copy style guide |
| 81 | +fpth = "styleguide.md" |
| 82 | +src = os.path.join(fpth) |
| 83 | +dst = os.path.join(dstdir, fpth) |
| 84 | +shutil.copy(src, dst) |
| 85 | + |
| 86 | +# -- copy DFN spec |
| 87 | +fpth = "readme.md" |
| 88 | +src = os.path.join("..", "doc", "mf6io", "mf6ivar", fpth) |
| 89 | +dst = os.path.join(dstdir, "dfn.md") |
| 90 | +shutil.copy(src, dst) |
| 91 | + |
| 92 | +# -- build the deprecations table -------------------------------------------- |
| 93 | +print("Build the deprecations markdown table") |
| 94 | +pth = os.path.join("..", "doc", "mf6io", "mf6ivar") |
| 95 | +args = (sys.executable, "deprecations.py") |
| 96 | +# run the command |
| 97 | +proc = Popen(args, stdout=PIPE, stderr=PIPE, cwd=pth) |
| 98 | +stdout, stderr = proc.communicate() |
| 99 | +if stdout: |
| 100 | + print(stdout.decode("utf-8")) |
| 101 | +if stderr: |
| 102 | + print("Errors:") |
| 103 | + print(stderr.decode("utf-8")) |
| 104 | + |
59 | 105 | # -- copy deprecations markdown --------------------------------------------- |
60 | 106 | print("Copy the deprecations table") |
61 | 107 | dstdir = "_mf6run" |
|
75 | 121 | if stdout: |
76 | 122 | print(stdout.decode("utf-8")) |
77 | 123 | if stderr: |
78 | | - print("Errors:\n{}".format(stderr.decode("utf-8"))) |
| 124 | + print("Errors:") |
| 125 | + print(stderr.decode("utf-8")) |
79 | 126 |
|
80 | 127 | # -- update the doxygen version number --------------------------------------- |
81 | 128 | print("Update the Doxyfile with the latest version number") |
|
86 | 133 | with open("Doxyfile", "w") as fp: |
87 | 134 | for line in lines: |
88 | 135 | if tag in line: |
89 | | - line = '{} = "version {}"\n'.format(tag, __version__) |
| 136 | + line = f'{tag} = "version {__version__}"\n' |
90 | 137 | fp.write(line) |
91 | 138 |
|
92 | 139 | # -- Project information ----------------------------------------------------- |
93 | 140 |
|
94 | | -project = "MODFLOW 6 Program Documentation" |
95 | | -copyright = "2023, MODFLOW Development Team" |
| 141 | +project = "MODFLOW 6" |
| 142 | +copyright = "2024, MODFLOW Development Team" |
96 | 143 | author = "MODFLOW Development Team" |
97 | 144 |
|
98 | 145 | # -- Project version --------------------------------------------------------- |
|
126 | 173 | # # Tell sphinx what the pygments highlight language should be. |
127 | 174 | # highlight_language = 'fortran' |
128 | 175 |
|
| 176 | +source_suffix = {".rst": "restructuredtext", ".md": "markdown"} |
| 177 | + |
129 | 178 | # Add any paths that contain templates here, relative to this directory. |
130 | 179 | templates_path = ["_templates"] |
131 | 180 |
|
|
0 commit comments