forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontributors.py
53 lines (40 loc) · 1.38 KB
/
contributors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Sphinx extension for listing code contributors to a release.
Usage::
.. contributors:: v0.23.0..v0.23.1
This will be replaced with a message indicating the number of
code contributors and commits, and then list each contributor
individually.
"""
from docutils import nodes
from docutils.parsers.rst import Directive
import git
from announce import build_components
class ContributorsDirective(Directive):
required_arguments = 1
name = 'contributors'
def run(self):
range_ = self.arguments[0]
try:
components = build_components(range_)
except git.GitCommandError:
return [
self.state.document.reporter.warning(
"Cannot find contributors for range '{}'".format(range_),
line=self.lineno)
]
else:
message = nodes.paragraph()
message += nodes.Text(components['author_message'])
listnode = nodes.bullet_list()
for author in components['authors']:
para = nodes.paragraph()
para += nodes.Text(author)
listnode += nodes.list_item('', para)
return [message, listnode]
def setup(app):
app.add_directive('contributors', ContributorsDirective)
return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}