summaryrefslogtreecommitdiffstats
path: root/scripts/gen-quip-0000.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gen-quip-0000.py')
-rwxr-xr-xscripts/gen-quip-0000.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/scripts/gen-quip-0000.py b/scripts/gen-quip-0000.py
new file mode 100755
index 0000000..0f2ded9
--- /dev/null
+++ b/scripts/gen-quip-0000.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2017 The Qt Company Ltd.
+# Contact: http://www.qt.io/licensing/
+#
+# You may use this file under the terms of the CC0 license.
+# See the file LICENSE.CC0 from this package for details.
+
+from email.parser import HeaderParser
+from glob import glob
+import os.path
+
+class RootQuip (dict):
+ def __init__(self, files):
+ parser = HeaderParser()
+ for quip in files:
+ with open(quip, 'r') as quipfp:
+ self[quip] = parser.parse(quipfp)
+
+ def last_name(names): # tool function for owners; not a method
+ while names and names[-1].startswith('<') and names[-1].endswith('>'):
+ names.pop()
+ return names[-1]
+
+ @staticmethod
+ def owners(authors, final=last_name):
+ return ', '.join(final(s) for s in (a.split() for a in authors.split(',')))
+ del last_name
+
+ def quip_entries(self):
+ fmt = ' <tr><td>%4s</td><td><a href="quip-%04d.html">%04d</a></td><td>%s</td><td>%s</td></tr>'
+ for filename in sorted(self):
+ q = self[filename]
+ num = int(q['QUIP'])
+ yield fmt % (q['Type'][:4], num, num, q['Title'], self.owners(q['Author']))
+
+ preamble = """\
+QUIP: 0
+Title: QUIP Index
+Author: Louai Al-Khanji, Edward Welbourne
+Status: Active
+Type: Informational
+Created: 2016-09-16
+Post-History: 2017-03-15
+
+QUIP Index
+==========
+
+This QUIP contains the index of all finalized Qt User-Submitted
+Improvement Proposals, known as QUIPs. A list of reviews of quip
+module changes, including any QUIPs under development, can be found in
+the code-review listing [0]_.
+
+The following QUIPs exist:
+
+.. raw:: html
+
+ <table>
+ <tr><th>type</th><th>number</th><th>title</th><th>owners</th></tr>
+"""
+
+ endpiece = """\
+ </table>
+
+.. [0] https://codereview.qt-project.org/#/q/project:meta/quips,n,z
+"""
+
+ def compose_body(self):
+ return self.preamble + '\n'.join(self.quip_entries()) + self.endpiece
+
+if __name__ == '__main__':
+ import sys
+ print RootQuip(sys.argv[1:]).compose_body()