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 Jun 10, 2022
1 parent 2b56971 commit 2182005
Show file tree
Hide file tree
Showing 3 changed files with 52 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
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ def run_repos_builder(*_):
subprocess.check_call("pwd; cp repos.json ../docs/html_extras/", shell=True)
os.chdir(last_dir)

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

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

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

Expand Down Expand Up @@ -321,3 +325,4 @@ def setup(app):
app.connect("autodoc-skip-member", autodoc_skip_member)
app.connect("builder-inited", run_apidoc)
#app.connect("html-page-context", run_repos_builder)
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 @@ -3,9 +3,10 @@ sphinx>=1.2
sphinx-autodoc-annotation

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

0 comments on commit 2182005

Please sign in to comment.