summaryrefslogtreecommitdiffstats
path: root/packaging/mkNEWS
blob: 69c23e306a638041f5e6399dc1eca63eac023e54 (plain)
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
39
40
41
42
#!/usr/bin/python3

import re
import os
import sys
import subprocess

wiki = "http://wiki.inkscape.org/wiki/index.php"

if len(sys.argv) < 2:
    print("Usage: mkNEWS <release-version>")
    sys.exit(1)

release_number = sys.argv[1]

# TODO: Use beautifulsoup
url = "%s/Release_notes/%s" %(wiki, release_number)
result = subprocess.run(["w3m", "-dump", url], stdout=subprocess.PIPE)

re_edit = re.compile(r'\[\[\d+\]edit\]', flags=re.IGNORECASE)
re_overview = re.compile(r'^\s*Inkscape '+release_number)
re_prev_rels = re.compile(r'^\s*Previous releases')

seen_overview = 0;
for line in result.stdout.decode('utf-8').split("\n"):
    line = re_edit.sub("", line)

    # Ignore everything before the overview section
    if re_overview.match(line):
        seen_overview = 1

    # Ignore everything from Previous releases onward
    if re_prev_rels.match(line):
        break

    # TODO: Implement some additional formatting/cleanup

    if seen_overview:
        print(line)

print("\nFor information on prior releases, please see:\n")
print("    %s/Inkscape\n" %(wiki))