Copy the -notes.rst file to the OUTPUT_DIR and use pandoc to translate it to markdown. That results in both README.rst and README.md files that can be used for on github for the release. Parameters ---------- version: str Release version, e.g., '2.3.2',
(version)
| 28 | OUTPUT_FILE = "README" |
| 29 | |
| 30 | def write_release(version): |
| 31 | """ |
| 32 | Copy the <version>-notes.rst file to the OUTPUT_DIR and use |
| 33 | pandoc to translate it to markdown. That results in both |
| 34 | README.rst and README.md files that can be used for on |
| 35 | github for the release. |
| 36 | |
| 37 | Parameters |
| 38 | ---------- |
| 39 | version: str |
| 40 | Release version, e.g., '2.3.2', etc. |
| 41 | |
| 42 | Returns |
| 43 | ------- |
| 44 | None. |
| 45 | |
| 46 | """ |
| 47 | notes = Path(NOTES_DIR) / f"{version}-notes.rst" |
| 48 | outdir = Path(OUTPUT_DIR) |
| 49 | outdir.mkdir(exist_ok=True) |
| 50 | target_md = outdir / f"{OUTPUT_FILE}.md" |
| 51 | target_rst = outdir / f"{OUTPUT_FILE}.rst" |
| 52 | |
| 53 | # translate README.rst to md for posting on GitHub |
| 54 | os.system(f"cp {notes} {target_rst}") |
| 55 | subprocess.run( |
| 56 | ["pandoc", "-s", "-o", str(target_md), str(target_rst), "--wrap=preserve"], |
| 57 | check=True, |
| 58 | ) |
| 59 | |
| 60 | |
| 61 | if __name__ == '__main__': |
no test coverage detected
searching dependent graphs…