Skip to content

Commit 025f20f

Browse files
committed
docs: Auto-create CHANGES from git
1 parent d537e8b commit 025f20f

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
120120
def run_apidoc(_):
121121
subprocess.check_call("sphinx-apidoc --separate -f -o . ../errbot", shell=True)
122122

123+
# -- Changelog -----------------------------------------------------------------
124+
125+
def run_changelog(_):
126+
subprocess.check_call("gitchangelog", shell=True)
127+
123128
# -- Options for HTML output ---------------------------------------------------
124129

125130
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -315,3 +320,4 @@ def run_apidoc(_):
315320
def setup(app):
316321
app.connect("autodoc-skip-member", autodoc_skip_member)
317322
app.connect("builder-inited", run_apidoc)
323+
app.connect("builder-inited", run_changelog)

docs/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ sphinx>=1.2
55
https://github.com/zoni/sphinx-autodoc-annotation/archive/issue-2.zip
66

77
-e .
8-
sleekxmpp
8+
gitchangelog
9+
hypchat
910
irc
1011
pyfire
1112
python-telegram-bot
1213
slackclient
13-
hypchat
14+
sleekxmpp

0 commit comments

Comments
 (0)