File: generate_changelog

package info (click to toggle)
toot 0.51.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,108 kB
  • sloc: python: 9,284; makefile: 41
file content (38 lines) | stat: -rwxr-xr-x 868 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3

"""
Generates a more user-readable changelog from changelog.yaml.
"""

import textwrap
import yaml

with open("changelog.yaml", "r") as f:
    data = yaml.safe_load(f)

print("Changelog")
print("---------")
print()
print("<!-- Do not edit. This file is automatically generated from changelog.yaml.-->")
print()

for version in data.keys():
    date = data[version]["date"]
    changes = data[version]["changes"]
    print(f"**{version} ({date})**")
    print()

    if "description" in data[version]:
        print(textwrap.dedent(data[version]["description"]))
        print()

    for c in changes:
        lines = textwrap.wrap(c, 78)
        initial = True
        for line in lines:
            if initial:
                print("* " + line)
                initial = False
            else:
                print("  " + line)
    print()