Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Auto-create CHANGES from git #1321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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