-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added script to regroup release notes for official release by parsing…
… dev release notes. improve naming of drop downs for generating dev release notes to be consistent
- Loading branch information
1 parent
4ff2950
commit 78987fb
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
internal/scripts/dev_tools/compile_official_release_notes.py
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#! /usr/bin/env python3 | ||
|
||
# Written by George McCabe <[email protected]> | ||
# Helper script that parses release notes from development releases, | ||
# gathers all issues by category, sorts them by issue number, then | ||
# outputs the formatted content | ||
# Note: Careful review and massaging of output is likely needed | ||
# Run this script from the top of the repository to parse | ||
# Assumes location and name of release notes RST file | ||
|
||
import re | ||
|
||
infile = './docs/Users_Guide/release-notes.rst' | ||
|
||
with open(infile, 'r') as file_handle: | ||
content = file_handle.read().splitlines() | ||
|
||
category = None | ||
items = {} | ||
# gather issues and organize them by category | ||
for line in content: | ||
if match := re.match(r' .. dropdown:: (.*)', line): | ||
category = match.group(1) | ||
if not items.get(category): | ||
items[category] = [] | ||
continue | ||
if category is None: continue | ||
if not line: continue | ||
if line.strip().startswith('.. _'): | ||
break | ||
if line.lstrip().startswith('*'): | ||
items[category].append(line) | ||
elif line.strip() == 'NONE' or line.startswith('MET') or line.startswith('---') or line.startswith('==='): | ||
continue | ||
else: | ||
items[category][-1] += f'\n{line}' | ||
|
||
# get issues in each category to sort | ||
issues = {} | ||
for cat, item_list in items.items(): | ||
if not issues.get(cat): | ||
issues[cat] = {} | ||
for issue in item_list: | ||
match = re.match(r'.*\#(\d+).*', issue.replace('\n', '')) | ||
if match: | ||
issues[cat][match.group(1)] = issue | ||
|
||
# sort issues within each category and print formatted result | ||
for cat in issues: | ||
nums = sorted([int(item) for item in issues[cat].keys()]) | ||
print(f" .. dropdown:: {cat}\n") | ||
for num in nums: | ||
print(issues[cat][str(num)]) | ||
print() |
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