mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-01 03:00:13 -04:00
Added script to generate milestone using github api
Closes https://github.com/CoolProp/CoolProp/issues/278 Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
28
dev/scripts/milestone2rst.py
Normal file
28
dev/scripts/milestone2rst.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from __future__ import print_function
|
||||
import urllib, json, sys
|
||||
|
||||
def generate(milestone):
|
||||
|
||||
# Find the milestone number for the given name
|
||||
milestones_json = json.loads(urllib.urlopen('https://api.github.com/repos/CoolProp/CoolProp/milestones').read())
|
||||
|
||||
# Map between name and number
|
||||
title_to_number_map = {stone['title']: stone['number'] for stone in milestones_json}
|
||||
|
||||
# Find the desired number
|
||||
number = title_to_number_map[milestone]
|
||||
|
||||
# Get the issues associated with the milestone
|
||||
issues = json.loads(urllib.urlopen('https://api.github.com/repos/CoolProp/CoolProp/issues?state=all&milestone='+str(number)).read())
|
||||
|
||||
# Make sure all issues are closed in this milestone
|
||||
for issue in issues:
|
||||
if issue['state'] != 'closed': raise ValueError('This issue is still open: ' + issue['title'])
|
||||
|
||||
rst = '\n'.join(['`#{n:d}<http://github.com/CoolProp/CoolProp/issues/{n:d}>` : {t:s}'.format(n = issue['number'], t = issue['title']) for issue in issues])
|
||||
|
||||
if __name__=='__main__':
|
||||
if len(sys.argv) != 2:
|
||||
raise ValueError('This script should be called like this: python milestone2rst.py v5')
|
||||
|
||||
print(generate(sys.argv[1]))
|
||||
Reference in New Issue
Block a user