Skip to content

Commit d9ff2b0

Browse files
committed
Fix release notes creation, create notes also for prereleases
1 parent a5b6ba8 commit d9ff2b0

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

pavement.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def set_version(args):
177177

178178

179179
@task
180-
@needs('clean', '_prepare_build', '_release_notes', 'generate_setup',
180+
@needs('clean', '_prepare_build', 'release_notes_plugin', 'generate_setup',
181181
'minilib', 'setuptools.command.sdist')
182182
def sdist():
183183
"""Creates source distribution with bundled dependencies"""
@@ -204,10 +204,9 @@ def _prepare_build():
204204

205205

206206
@task
207-
def _release_notes():
208-
if FINAL_RELEASE:
209-
changes = _download_and_format_issues(VERSION)
210-
_update_release_notes_plugin(changes)
207+
def release_notes_plugin():
208+
changes = _download_and_format_issues()
209+
_update_release_notes_plugin(changes)
211210

212211

213212
@task
@@ -258,7 +257,7 @@ def _after_distribution():
258257
_clean(keep_dist=True)
259258

260259

261-
def _download_and_format_issues(milestone):
260+
def _download_and_format_issues():
262261
try:
263262
from robot.utils import HtmlWriter, html_format
264263
except ImportError:
@@ -268,17 +267,19 @@ def _download_and_format_issues(milestone):
268267
writer.start('table', attrs={'border': '1'})
269268
writer.start('tr')
270269
for header in ['ID', 'Type', 'Priority', 'Summary']:
271-
writer.element('td', header, escape=False)
270+
writer.element(
271+
'td', html_format('*{}*'.format(header)), escape=False)
272272
writer.end('tr')
273-
issues = list(_get_issues(milestone))
273+
issues = list(_get_issues())
274274
for issue in issues:
275+
writer.start('tr')
275276
link_tmpl = '<a href="http://github.com/robotframework/RIDE/issues/{0}">Issue {0}</a>'
276277
row = [link_tmpl.format(issue.number),
277278
find_type(issue),
278279
find_priority(issue),
279280
issue.title]
280281
for cell in row:
281-
writer.element('td', html_format(cell), escape=False)
282+
writer.element('td', cell, escape=False)
282283
writer.end('tr')
283284
writer.end('table')
284285
writer.element('p', 'Altogether %d issues.' % len(issues))
@@ -294,18 +295,18 @@ def _update_release_notes_plugin(changes):
294295

295296

296297
@task
297-
@consume_args
298-
def release_notes(args):
298+
def release_notes():
299299
milestone = args[0]
300-
issues = _get_issues(milestone)
300+
issues = _get_issues()
301301
print """ID | Type | Priority | Summary
302302
--- | ---- | -------- | ------- """
303303
for i in issues:
304304
print ' | '.join(('#{}'.format(i.number), find_type(i),
305305
find_priority(i), i.title))
306306

307307

308-
def _get_issues(milestone):
308+
def _get_issues():
309+
milestone = re.split('[ab-]', VERSION)[0]
309310
import getpass
310311
from github3 import login
311312
username = raw_input('Enter GitHub username for downloading issues: ')
@@ -317,8 +318,20 @@ def _get_issues(milestone):
317318
if milestone_number is None:
318319
print 'milestone not found'
319320
sys.exit(1)
320-
return [i for i in repo.iter_issues(
321-
milestone=milestone_number, state='closed')]
321+
issues = list(repo.iter_issues(milestone=milestone_number, state='closed'))
322+
issues.sort(cmp=issue_sorter)
323+
return issues
324+
325+
326+
def issue_sorter(i1, i2):
327+
prio_mapping = {
328+
'critical': 0,
329+
'high': 1,
330+
'medium': 2,
331+
'low': 3
332+
}
333+
prio1, prio2 = find_priority(i1), find_priority(i2)
334+
return cmp(prio_mapping[prio1], prio_mapping[prio2])
322335

323336

324337
def find_type(issue):

0 commit comments

Comments
 (0)