Skip to content

Commit

Permalink
docs: Auto-create CHANGES from git
Browse files Browse the repository at this point in the history
  • Loading branch information
sijis committed Apr 9, 2019
1 parent d537e8b commit 025f20f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .gitchangelog.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Reference: https://github.com/vaab/gitchangelog/blob/master/src/gitchangelog/gitchangelog.rc.reference

FILENAME = 'CHANGES.rst'

unreleased_version_label = 'Unreleased (master)'
include_merge = False

section_regexps = [
('New', [
r'^[Nn]ew',
r'^[Aa]dd',
]),
('Fixes', [
r'^[Ff]ix',
r'^[Uu]pdate',
r'[Aa]llow',
]),
('Docs', [
r'([Dd]ocs|[Dd]ocumentation)',
r'[Bb]adges?',
]),
('Other', None ## Match all lines
),
]

subject_process = (strip | ucfirst | final_dot)
ignore_regexps = [
r'[Pp][Ee][Pp]\-?8',
r'[Tt][Yy][Pp][Oo]',
r'spelling',
#r'[Ff]ormat(ing)?',
r'^$', ## ignore commits with empty messages
]

body_process = ReSub(r'.*', r'') | strip

revs = ["^4.0.0", "HEAD"]

def write_changelog(lines):
"""Write changelog to file."""
with open(FILENAME, 'wt') as f:
f.writelines(lines)

publish = write_changelog
6 changes: 6 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
def run_apidoc(_):
subprocess.check_call("sphinx-apidoc --separate -f -o . ../errbot", shell=True)

# -- Changelog -----------------------------------------------------------------

def run_changelog(_):
subprocess.check_call("gitchangelog", shell=True)

# -- Options for HTML output ---------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down Expand Up @@ -315,3 +320,4 @@ def run_apidoc(_):
def setup(app):
app.connect("autodoc-skip-member", autodoc_skip_member)
app.connect("builder-inited", run_apidoc)
app.connect("builder-inited", run_changelog)
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ sphinx>=1.2
https://github.com/zoni/sphinx-autodoc-annotation/archive/issue-2.zip

-e .
sleekxmpp
gitchangelog
hypchat
irc
pyfire
python-telegram-bot
slackclient
hypchat
sleekxmpp

0 comments on commit 025f20f

Please sign in to comment.