|
15 | 15 |
|
16 | 16 | # add flopy root directory to the python path |
17 | 17 | sys.path.insert(0, os.path.abspath("..")) |
18 | | -from flopy import __version__ |
| 18 | +from flopy import __version__, __author__ |
19 | 19 |
|
20 | 20 | # -- determine if running on readthedocs ------------------------------------ |
21 | 21 | on_rtd = os.environ.get('READTHEDOCS') == 'True' |
22 | 22 |
|
| 23 | +# -- determine if this version is a release candidate |
| 24 | +with open("../README.md", "r") as f: |
| 25 | + lines = f.readlines() |
| 26 | +rc_text = "" |
| 27 | +for line in lines: |
| 28 | + if line.startswith("### Version"): |
| 29 | + if "release candidate" in line: |
| 30 | + rc_text = "release candidate" |
| 31 | + break |
| 32 | + |
| 33 | +# -- update version number in main.rst |
| 34 | +rst_name = "main.rst" |
| 35 | +with open(rst_name, "r") as f: |
| 36 | + lines = f.readlines() |
| 37 | +with open(rst_name, "w") as f: |
| 38 | + for line in lines: |
| 39 | + if line.startswith("**Documentation for version"): |
| 40 | + line = "**Documentation for version {}".format(__version__) |
| 41 | + if rc_text != "": |
| 42 | + line += " --- {}".format(rc_text) |
| 43 | + line += "**\n" |
| 44 | + f.write(line) |
| 45 | + |
| 46 | +# -- update authors in introduction.rst |
| 47 | +rst_name = "introduction.rst" |
| 48 | +with open(rst_name, "r") as f: |
| 49 | + lines = f.readlines() |
| 50 | +tag_start = "FloPy Development Team" |
| 51 | +tag_end = "How to Cite" |
| 52 | +write_line = True |
| 53 | +with open(rst_name, "w") as f: |
| 54 | + for line in lines: |
| 55 | + if line.startswith(tag_start): |
| 56 | + write_line = False |
| 57 | + # update author list |
| 58 | + line += ( |
| 59 | + "======================\n\n" |
| 60 | + "FloPy is developed by a team of MODFLOW users that have " |
| 61 | + "switched over to using\nPython for model development and " |
| 62 | + "post-processing. Members of the team\n" |
| 63 | + "currently include:\n\n" |
| 64 | + ) |
| 65 | + authors = __author__.split(sep=",") |
| 66 | + for author in authors: |
| 67 | + line += " * {}\n".format(author.strip()) |
| 68 | + line += " * and others\n\n" |
| 69 | + f.write(line) |
| 70 | + elif line.startswith(tag_end): |
| 71 | + write_line = True |
| 72 | + if write_line: |
| 73 | + f.write(line) |
| 74 | + |
| 75 | + |
23 | 76 | # -- create source rst files ------------------------------------------------ |
24 | 77 | cmd = "sphinx-apidoc -e -o source/ ../flopy/" |
25 | 78 | print(cmd) |
26 | 79 | os.system(cmd) |
27 | 80 |
|
28 | | -# -- programatically create rst files --------------------------------------- |
| 81 | +# -- programmatically create rst files --------------------------------------- |
29 | 82 | cmd = ("python", "create_rstfiles.py") |
30 | 83 | print(" ".join(cmd)) |
31 | 84 | os.system(" ".join(cmd)) |
|
38 | 91 |
|
39 | 92 | # -- Project information ----------------------------------------------------- |
40 | 93 | project = "flopy Documentation" |
41 | | -copyright = "2020, Bakker, Mark, Post, Vincent, Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N." |
42 | | -author = "Bakker, Mark, Post, Vincent, Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N." |
| 94 | +copyright = "2021, {}".format(__author__) |
| 95 | +author = __author__ |
43 | 96 |
|
44 | 97 | # The version. |
45 | 98 | version = __version__ |
|
0 commit comments