Skip to content

Commit 2182005

Browse files
committed
docs: Auto-create CHANGES from git
1 parent 2b56971 commit 2182005

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

.gitchangelog.rc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Reference: https://github.com/vaab/gitchangelog/blob/master/src/gitchangelog/gitchangelog.rc.reference
2+
3+
FILENAME = 'CHANGES.rst'
4+
5+
unreleased_version_label = 'Unreleased (master)'
6+
include_merge = False
7+
8+
section_regexps = [
9+
('New', [
10+
r'^[Nn]ew',
11+
r'^[Aa]dd',
12+
]),
13+
('Fixes', [
14+
r'^[Ff]ix',
15+
r'^[Uu]pdate',
16+
r'[Aa]llow',
17+
]),
18+
('Docs', [
19+
r'([Dd]ocs|[Dd]ocumentation)',
20+
r'[Bb]adges?',
21+
]),
22+
('Other', None ## Match all lines
23+
),
24+
]
25+
26+
subject_process = (strip | ucfirst | final_dot)
27+
ignore_regexps = [
28+
r'[Pp][Ee][Pp]\-?8',
29+
r'[Tt][Yy][Pp][Oo]',
30+
r'spelling',
31+
#r'[Ff]ormat(ing)?',
32+
r'^$', ## ignore commits with empty messages
33+
]
34+
35+
body_process = ReSub(r'.*', r'') | strip
36+
37+
revs = ["^4.0.0", "HEAD"]
38+
39+
def write_changelog(lines):
40+
"""Write changelog to file."""
41+
with open(FILENAME, 'wt') as f:
42+
f.writelines(lines)
43+
44+
publish = write_changelog

docs/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ def run_repos_builder(*_):
130130
subprocess.check_call("pwd; cp repos.json ../docs/html_extras/", shell=True)
131131
os.chdir(last_dir)
132132

133+
# -- Changelog -----------------------------------------------------------------
134+
135+
def run_changelog(_):
136+
subprocess.check_call("gitchangelog", shell=True)
133137

134138
# -- Options for HTML output ---------------------------------------------------
135139

@@ -321,3 +325,4 @@ def setup(app):
321325
app.connect("autodoc-skip-member", autodoc_skip_member)
322326
app.connect("builder-inited", run_apidoc)
323327
#app.connect("html-page-context", run_repos_builder)
328+
app.connect("builder-inited", run_changelog)

docs/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ sphinx>=1.2
33
sphinx-autodoc-annotation
44

55
-e .
6-
slixmpp
6+
gitchangelog
7+
hypchat
78
irc
89
pyfire
910
python-telegram-bot
1011
slackclient
11-
hypchat
12+
slixmpp

0 commit comments

Comments
 (0)