diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:22 +0000 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:22 +0000 |
commit | 738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (patch) | |
tree | 0397d9bf3b12c903dc73419585df231397ff343c /bin/xmlagenda.py | |
parent | e7885e3af440eaef38a9301fd92a105afc8ddebb (diff) |
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'bin/xmlagenda.py')
-rwxr-xr-x | bin/xmlagenda.py | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/bin/xmlagenda.py b/bin/xmlagenda.py index 3009e4c..7937331 100755 --- a/bin/xmlagenda.py +++ b/bin/xmlagenda.py @@ -17,24 +17,23 @@ # The team members # FIXME: These names really should be external to this script -team = 'Bill Greg Steven Gary Ken Brandon Sohail Jim David'.split() -team.sort() +team = sorted('Steven Gary Greg Ken Jim David Bill Sergey Jason'.split()) # The elements to be picked out of the issue PickList = [ - # sort key -- these are used to sort the entry - 'target_milestone', 'priority', 'votes_desc', 'creation_ts', - # payload -- these are displayed - 'issue_id', 'votes', 'issue_type', 'target_milestone', - 'priority', 'assigned_to', 'short_desc', - ] + # sort key -- these are used to sort the entry + 'target_milestone', 'priority', 'votes_desc', 'creation_ts', + # payload -- these are displayed + 'issue_id', 'votes', 'issue_type', 'target_milestone', + 'priority', 'assigned_to', 'short_desc', + ] # Conbert a leaf element into its value as a text string # We assume it's "short enough" that there's only one substring def Value(element): - v = element.firstChild - if v is None: return '' - return v.nodeValue + v = element.firstChild + if v is None: return '' + return v.nodeValue # Parse the XML issues file and produce a DOM for it import sys @@ -47,26 +46,26 @@ xml = parse(xml) # and put them in our list of issues. issues = [] for issuezilla in xml.childNodes: - # The Issuezilla element contains the issues - if issuezilla.nodeType != issuezilla.ELEMENT_NODE: continue - for issue in issuezilla.childNodes: - # The issue elements contain the info for an issue - if issue.nodeType != issue.ELEMENT_NODE: continue - # Accumulate the pieces we want to include - d = {} - for element in issue.childNodes: - if element.nodeName in PickList: - d[element.nodeName] = Value(element) - # convert 'votes' to numeric, ascending and descending - try: - v = int('0' + d['votes']) - except KeyError: - pass - else: - d['votes_desc'] = -v - d['votes'] = v - # Marshal the elements and add them to the list - issues.append([ d[ix] for ix in PickList ]) + # The Issuezilla element contains the issues + if issuezilla.nodeType != issuezilla.ELEMENT_NODE: continue + for issue in issuezilla.childNodes: + # The issue elements contain the info for an issue + if issue.nodeType != issue.ELEMENT_NODE: continue + # Accumulate the pieces we want to include + d = {} + for element in issue.childNodes: + if element.nodeName in PickList: + d[element.nodeName] = Value(element) + # convert 'votes' to numeric, ascending and descending + try: + v = int('0' + d['votes']) + except KeyError: + pass + else: + d['votes_desc'] = -v + d['votes'] = v + # Marshal the elements and add them to the list + issues.append([ d[ix] for ix in PickList ]) issues.sort() # Transcribe the issues into comma-separated values. @@ -75,16 +74,16 @@ import csv writer = csv.writer(open('editlist.csv', 'w')) # header writer.writerow(['ID', 'Votes', 'Type/Member', 'Milestone', - 'Pri', 'Owner', 'Summary/Comments']) + 'Pri', 'Owner', 'Summary/Comments']) for issue in issues: - row = issue[4:] # strip off sort key - #row[0] = """=hyperlink("http://scons.tigris.org/issues/show_bug.cgi?id=%s","%s")""" % (row[0],row[0]) - if row[3] == '-unspecified-': row[3] = 'triage' - writer.writerow(['','','','','','','']) - writer.writerow(row) - writer.writerow(['','','consensus','','','','']) - writer.writerow(['','','','','','','']) - for member in team: writer.writerow(['','',member,'','','','']) + row = issue[4:] # strip off sort key + #row[0] = """=hyperlink("http://scons.tigris.org/issues/show_bug.cgi?id=%s","%s")""" % (row[0],row[0]) + if row[3] == '-unspecified-': row[3] = 'triage' + writer.writerow(['','','','','','','']) + writer.writerow(row) + writer.writerow(['','','consensus','','','','']) + writer.writerow(['','','','','','','']) + for member in team: writer.writerow(['','',member,'','','','']) # Local Variables: # tab-width:4 |