Skip to content

Commit 6dd5dc0

Browse files
TomAugspurgerPingviinituutti
authored andcommitted
DOC: Handle exceptions when computing contributors. (pandas-dev#23714)
* DOC: fix the build maybe
1 parent 4fbbd73 commit 6dd5dc0

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

doc/sphinxext/contributors.py

+20-11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"""
1111
from docutils import nodes
1212
from docutils.parsers.rst import Directive
13+
import git
1314

1415
from announce import build_components
1516

@@ -19,17 +20,25 @@ class ContributorsDirective(Directive):
1920
name = 'contributors'
2021

2122
def run(self):
22-
components = build_components(self.arguments[0])
23-
24-
message = nodes.paragraph()
25-
message += nodes.Text(components['author_message'])
26-
27-
listnode = nodes.bullet_list()
28-
29-
for author in components['authors']:
30-
para = nodes.paragraph()
31-
para += nodes.Text(author)
32-
listnode += nodes.list_item('', para)
23+
range_ = self.arguments[0]
24+
try:
25+
components = build_components(range_)
26+
except git.GitCommandError:
27+
return [
28+
self.state.document.reporter.warning(
29+
"Cannot find contributors for range '{}'".format(range_),
30+
line=self.lineno)
31+
]
32+
else:
33+
message = nodes.paragraph()
34+
message += nodes.Text(components['author_message'])
35+
36+
listnode = nodes.bullet_list()
37+
38+
for author in components['authors']:
39+
para = nodes.paragraph()
40+
para += nodes.Text(author)
41+
listnode += nodes.list_item('', para)
3342

3443
return [message, listnode]
3544

0 commit comments

Comments
 (0)