mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Add scripts for process automation
This commit is contained in:
parent
f76deb71ab
commit
b71662f4dd
4 changed files with 289 additions and 0 deletions
34
scripts/extract_changelog.py
Normal file
34
scripts/extract_changelog.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import argparse
|
||||
import re
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description = 'Extract the changelog to be inserted to the release description')
|
||||
parser.add_argument('--changelog', type = str, help = 'Path to the changelog file', required = True)
|
||||
parser.add_argument('--version', type = str, help = 'Cura version to be extracted', required = True)
|
||||
args = parser.parse_args()
|
||||
|
||||
start_token = f"[{args.version}]"
|
||||
pattern_stop_log = "\[\d+(\.\d+){1,2}\]"
|
||||
log_line = False
|
||||
first_chapter = True
|
||||
|
||||
with open(args.changelog, "r") as changelog_file:
|
||||
for line in changelog_file.readlines():
|
||||
line = line.strip()
|
||||
|
||||
if log_line:
|
||||
if re.match(pattern_stop_log, line):
|
||||
log_line = False
|
||||
elif len(line) > 0:
|
||||
if line.startswith('*'):
|
||||
if not first_chapter:
|
||||
print("")
|
||||
first_chapter = False
|
||||
|
||||
line = line[1:].strip()
|
||||
print(f"<H2>{line}</H2>\n")
|
||||
else:
|
||||
print(line)
|
||||
elif line == start_token:
|
||||
log_line = True
|
Loading…
Add table
Add a link
Reference in a new issue