-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use straxen documentation building functions to avoid duplicated codes
- Loading branch information
Showing
3 changed files
with
11 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,10 @@ | ||
# Copied from straxen/docs/source/build_release_notes.py | ||
# https://github.com/XENONnT/straxen/blob/a34a02393001f13755c3f84d15924f83bc86c4db | ||
# /docs/source/build_release_notes.py | ||
|
||
import os | ||
from straxen.docs_utils import convert_release_notes | ||
|
||
from m2r import convert | ||
|
||
header = """ | ||
Release notes | ||
============== | ||
""" | ||
|
||
|
||
def convert_release_notes(): | ||
"""Convert the release notes to an RST page with links to PRs.""" | ||
if __name__ == "__main__": | ||
this_dir = os.path.dirname(os.path.realpath(__file__)) | ||
notes = os.path.join(this_dir, "..", "..", "HISTORY.md") | ||
with open(notes, "r") as f: | ||
notes = f.read() | ||
rst = convert(notes) | ||
with_ref = "" | ||
for line in rst.split("\n"): | ||
# Get URL for PR | ||
if "#" in line: | ||
pr_number = line.split("#")[1] | ||
while len(pr_number): | ||
try: | ||
pr_number = int(pr_number) | ||
break | ||
except ValueError: | ||
# Too many tailing characters to be an int | ||
pr_number = pr_number[:-1] | ||
if pr_number: | ||
line = line.replace( | ||
f"#{pr_number}", | ||
f"`#{pr_number} <https://github.com/XENONnT/fuse/pull/{pr_number}>`_", | ||
) | ||
with_ref += line + "\n" | ||
target = os.path.join(this_dir, "release_notes.rst") | ||
|
||
with open(target, "w") as f: | ||
f.write(header + with_ref) | ||
|
||
|
||
if __name__ == "__main__": | ||
convert_release_notes() | ||
pull_url = "https://github.com/XENONnT/fuse/pull" | ||
convert_release_notes(notes, target, pull_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters