[Libreoffice-commits] dev-tools.git: esc-reporting/esc-report.py

jan Iversen jani at libreoffice.org
Wed Apr 26 13:55:51 UTC 2017


 esc-reporting/esc-report.py |  513 +++++++++++++++++++++++---------------------
 1 file changed, 273 insertions(+), 240 deletions(-)

New commits:
commit c045f10420b9a92ed464bc368490fa7c65e86b26
Author: jan Iversen <jani at libreoffice.org>
Date:   Wed Apr 26 15:55:23 2017 +0200

    freeze flatODF before making Xisco report changes

diff --git a/esc-reporting/esc-report.py b/esc-reporting/esc-report.py
index 9b61b04..be9127a 100755
--- a/esc-reporting/esc-report.py
+++ b/esc-reporting/esc-report.py
@@ -455,248 +455,281 @@ def report_esc_prototype():
 def report_flatODF():
     global statList, cfg
 
-    fp = open('/tmp/esc_flatODF.fods', 'w', encoding='utf-8')
-    print('<?xml version="1.0" encoding="UTF-8"?>' +
-          '<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" ' +
-          'xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" ' +
-          'xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" ' +
-          'xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" ' +
-          'xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" ' +
-          'xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" ' +
-          'xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" ' +
-          'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" ' +
-          'xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" ' +
-          'xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" ' +
-          'xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" ' +
-          'xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" ' +
-          'xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" ' +
-          'xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" ' +
-          'xmlns:math="http://www.w3.org/1998/Math/MathML" ' +
-          'xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" ' +
-          'xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" ' +
-          'xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" ' +
-          'xmlns:ooo="http://openoffice.org/2004/office" ' +
-          'xmlns:ooow="http://openoffice.org/2004/writer" ' +
-          'xmlns:oooc="http://openoffice.org/2004/calc" ' +
-          'xmlns:dom="http://www.w3.org/2001/xml-events" ' +
-          'xmlns:xforms="http://www.w3.org/2002/xforms" ' +
-          'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
-          'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
-          'xmlns:rpt="http://openoffice.org/2005/report" ' +
-          'xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" ' +
-          'xmlns:xhtml="http://www.w3.org/1999/xhtml" ' +
-          'xmlns:grddl="http://www.w3.org/2003/g/data-view#" ' +
-          'xmlns:tableooo="http://openoffice.org/2009/table" ' +
-          'xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" ' +
-          'xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" ' +
-          'xmlns:css3t="http://www.w3.org/TR/css3-text/" ' +
-          'office:version="1.2" ' +
-          'grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl" ' +
-          'office:mimetype="application/vnd.oasis.opendocument.spreadsheet">' +
-          '\n', file=fp)
-
-    print('<office:styles>' +
-          '<style:style style:name="boldheader" style:family="table-cell" style:parent-style-name="Default">' +
-          '<style:text-properties fo:font-style="italic" fo:font-weight="bold"/>' +
-          '</style:style>' +
-          '<number:date-style style:name="isodatenum">' +
-          '<number:year number:style="long"/>' +
-          '<number:text>-</number:text>' +
-          '<number:month number:style="long"/>' +
-          '<number:text>-</number:text>' +
-          '<number:day number:style="long"/>' +
-          '</number:date-style>' +
-          '<style:style style:name="isodate" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="isodatenum">' +
-          '<style:text-properties style:text-position=""/>' +
-          '</style:style>' +
-          '</office:styles>' +
-          '\n', file=fp)
-
-    print('<office:body>' +
-          '<office:spreadsheet>' +
-          '<table:table table:name="Data">' +
-          '<table:table-row table:style-name="ro2">' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Date</text:p></table:table-cell>' 
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open Old</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed Old</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 4.0</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 4.0</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 4.1</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 4.1</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 4.2</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 4.2</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 4.3</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 4.3</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 4.4</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 4.4</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 5.0</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 5.0</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 5.1</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 5.1</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open 5.2</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed 5.2</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total Old</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 4.0</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 4.1</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 4.2</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 4.3</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 4.4</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 5.0</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 5.1</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total 5.2</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total Open</text:p></table:table-cell>' +
-          '<table:table-cell office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total Closed</text:p></table:table-cell>' +
-          '<table:table-cell table:number-columns-repeated="11"/></table:table-row>' +
-          '\n', file=fp)
-
-    print('<table:table-row table:style-name="ro1">' +
-          '<table:table-cell table:style-name="isodate" office:value-type="date" office:date-value="' +
-          statList['addDate'] + '" calcext:value-type="date"><text:p>' +
-          statList['addDate'] + '</text:p></table:table-cell>' +
-          '\n', file=fp)
-
-    print('<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['old']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.T2]-[.B2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.0']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.U2]-[.D2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.1']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.V2]-[.F2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.2']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.W2]-[.H2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.3']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.X2]-[.J2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.4']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.Y2]-[.L2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['5.0']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.Z2]-[.N2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['5.1']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.AA2]-[.P2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['5.2']['open']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.AB2]-[.R2]" office:value-type="float"  calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['old']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.0']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.1']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.2']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.3']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['4.4']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['5.0']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['5.1']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['MAB']['5.2']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:style-name="ce3" table:formula="of:=[.B2]+[.D2]+[.F2]+[.H2]+[.J2]+[.L2]+[.N2]+[.P2]+[.R2]" office:value-type="float"/>' +
-          '<table:table-cell table:style-name="ce3" table:formula="of:=SUM([.T2:.Z2])-[.AC2]" office:value-type="float"/>' +
-          '</table:table-row>' +
-          '\n', file=fp)
-
-    print('<table:table-row/>' +
-          '<table:table-row>' +
-          '<table:table-cell table:style-name="boldheader" office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Date</text:p>' +
-          '</table:table-cell>' +
-          '<table:table-cell table:style-name="boldheader" office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Open</text:p>' +
-          '</table:table-cell>' +
-          '<table:table-cell table:style-name="boldheader" office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Closed</text:p>' +
-          '</table:table-cell>' +
-          '<table:table-cell table:style-name="boldheader" office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Total</text:p>' +
-          '</table:table-cell>' +
-          '<table:table-cell table:style-name="boldheader" office:value-type="string" calcext:value-type="string">' +
-          '<text:p>Date</text:p>' +
-          '</table:table-cell>' +
-          '\n', file=fp)
-
-
-    myOrder = ['Calc', 'Impress', 'Base', 'Draw', 'LibreOffice', 'Borders', 'Crashes', 'BASIC', 'Writer/RTF', 'Writer',
-               'Migration', 'Chart', 'Extensions', 'Formula Editor', 'Impress Remote', 'Installation', 'Linguistic',
-               'Printing and PDF export', 'UI', 'filters and storage', 'framework', 'graphics stack', 'sdk']
-    for i in myOrder:
-        print('<table:table-cell table:style-name="boldheader" office:value-type="string" calcext:value-type="string"><text:p>' +
-              i + '</text:p></table:table-cell>' +
-              '\n', file=fp)
-    print('</table:table-row>' +
-          '<table:table-row>' +
-          '<table:table-cell table:style-name="isodate" office:value-type="date" office:date-value="' +
-          statList['addDate'] +
-          '" calcext:value-type="date"><text:p>' +
-          statList['addDate'] +
-          '</text:p>' +
-          '</table:table-cell>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['regression']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:formula="of:=[.D5]-[.B5]" office:value-type="float"/>' +
-          '<table:table-cell office:value-type="float" office:value="' +
-          str(statList['data']['esc']['regression']['total']) + '" calcext:value-type="float"/>' +
-          '<table:table-cell table:style-name="isodate" table:formula="of:=[.A5]" office:value-type="date" />' +
-          '\n', file=fp)
-    for i in myOrder:
-        if i in statList['data']['esc']['component']['all']:
-	        print('<table:table-cell office:value-type="float" office:value="' +
-                  str(statList['data']['esc']['component']['all'][i]) + '" calcext:value-type="float"/>' +
-                  '\n', file = fp)
-        else:
-            print('<table:table-cell/>',
-                  '\n', file = fp)
-    print('</table:table-row>' +
-          '</table:table>' +
-          '</office:spreadsheet>' +
-          '</office:body>' +
-          '</office:document>' +
-          '\n', file=fp)
+    filename = cfg['homedir'] + 'bug-metrics.fods'
+    fp = open(filename, encoding='utf-8')
+    text = fp.read()
     fp.close()
-    fp = open('/tmp/esc_flatODF_body', 'w', encoding='utf-8')
-    print('File to add to series', file=fp)
-    fp.close
 
-    data = 'ESC flatODF, based on stats.json from '+statList['addDate']
+
+    rowHighPriority = \
+       '<table:table-row table:style-name="ro2">\n' \
+       '<table:table-cell table:style-name="isodate" office:value-type="date" office:date-value="{vDate}" calcext:value-type="date">\n' \
+            '<text:p>{vDate}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_old}" calcext:value-type="float">\n' \
+            '<text:p>{vO_old}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.T74]-[.B74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_40}" calcext:value-type="float">\n' \
+            '<text:p>{vO_40}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.U74]-[.D74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_41}" calcext:value-type="float">\n' \
+            '<text:p>{vO_41}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.V74]-[.F74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_42}" calcext:value-type="float">\n' \
+            '<text:p>{vO_42}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.W74]-[.H74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_43}" calcext:value-type="float">\n' \
+            '<text:p>{vO_43}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.X74]-[.J74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_44}" calcext:value-type="float">\n' \
+            '<text:p>{vO_44}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.Y74]-[.L74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_50}" calcext:value-type="float">\n' \
+            '<text:p>{vO_50}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.Z74]-[.N74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_51}" calcext:value-type="float">\n' \
+            '<text:p>{vO_51}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.AA74]-[.P74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_52}" calcext:value-type="float">\n' \
+            '<text:p>{vO_52}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.AB74]-[.R74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_53}" calcext:value-type="float">\n' \
+            '<text:p>{vO_53}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.AI74]-[.T74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_54}" calcext:value-type="float">\n' \
+            '<text:p>{vO_54}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.AJ74]-[.V74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vO_55}" calcext:value-type="float">\n' \
+            '<text:p>{vO_55}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.AK74]-[.X74]" office:value-type="float" office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_old}" calcext:value-type="float">\n' \
+            '<text:p>{vT_old}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_40}" calcext:value-type="float">\n' \
+            '<text:p>{vT_40}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_41}" calcext:value-type="float">\n' \
+            '<text:p>{vT_41}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_42}" calcext:value-type="float">\n' \
+            '<text:p>{vT_42}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_43}" calcext:value-type="float">\n' \
+            '<text:p>{vT_43}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_44}" calcext:value-type="float">\n' \
+            '<text:p>{vT_44}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_50}" calcext:value-type="float">\n' \
+            '<text:p>{vT_50}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_51}" calcext:value-type="float">\n' \
+            '<text:p>{vT_51}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_52}" calcext:value-type="float">\n' \
+            '<text:p>{vT_52}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_53}" calcext:value-type="float">\n' \
+       '<text:p>{vT_53}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_54}" calcext:value-type="float">\n' \
+       '<text:p>{vT_54}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vT_55}" calcext:value-type="float">\n' \
+       '<text:p>{vT_55}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:formula="of:=[.B74]+[.D74]+[.F74]+[.H74]+[.J74]+[.L74]+[.N74]+[.P74]+[.R74]+[.T74]+[.V74]+[.X74]" ' \
+            'office:value-type="float" office:value="-1" calcext:value-type="float">' \
+            '<text:p>-1</text:p></table:table-cell>' \
+       '<table:table-cell table:style-name="ce24" table:formula="of:=SUM([.Z74:.AK74])-[.AL74]" ' \
+            'office:value-type="float" office:value="-1" calcext:value-type="float">' \
+            '<text:p>-1</text:p></table:table-cell>' \
+       '</table:table-row>\n'.format(
+              vDate  = statList['addDate'],
+              vO_old = statList['data']['esc']['MAB']['old']['open'],
+              vT_old = statList['data']['esc']['MAB']['old']['total'],
+              vO_40  = statList['data']['esc']['MAB']['4.0']['open'],
+              vT_40  = statList['data']['esc']['MAB']['4.0']['total'],
+              vO_41  = statList['data']['esc']['MAB']['4.1']['open'],
+              vT_41  = statList['data']['esc']['MAB']['4.1']['total'],
+              vO_42  = statList['data']['esc']['MAB']['4.2']['open'],
+              vT_42  = statList['data']['esc']['MAB']['4.2']['total'],
+              vO_43  = statList['data']['esc']['MAB']['4.3']['open'],
+              vT_43  = statList['data']['esc']['MAB']['4.3']['total'],
+              vO_44  = statList['data']['esc']['MAB']['4.4']['open'],
+              vT_44  = statList['data']['esc']['MAB']['4.4']['total'],
+              vO_50  = statList['data']['esc']['MAB']['5.0']['open'],
+              vT_50  = statList['data']['esc']['MAB']['5.0']['total'],
+              vO_51  = statList['data']['esc']['MAB']['5.1']['open'],
+              vT_51  = statList['data']['esc']['MAB']['5.1']['total'],
+              vO_52  = statList['data']['esc']['MAB']['5.2']['open'],
+              vT_52  = statList['data']['esc']['MAB']['5.2']['total'],
+              vO_53  = statList['data']['esc']['MAB']['5.3']['open'],
+              vT_53  = statList['data']['esc']['MAB']['5.3']['total'],
+              vO_54  = 0,
+              vT_54  = 0,
+              vO_55  = 0,
+              vT_55  = 0)
+
+    rowRegressions = \
+       '<table:table-row table:style-name="ro2">\n' \
+       '<table:table-cell office:value-type="date" office:date-value="{vDate}" calcext:value-type="date">\n' \
+            '<text:p>{vDate}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vOpen}" calcext:value-type="float">\n' \
+            '<text:p>{vOpen}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="Default" table:formula="of:=[.D258]-[.B258]" office:value-type="float" ' \
+            'office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vTotal}" calcext:value-type="float">\n' \
+            '<text:p>{vTotal}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:style-name="isodate" table:formula="of:=[.A258]" office:value-type="date" ' \
+            'office:date-value="2001-01-01" calcext:value-type="date">\n' \
+            '<text:p>2001-01-01</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vSpreadsheet}" calcext:value-type="float">\n' \
+            '<text:p>{vSpreadsheet}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vPresentation}" calcext:value-type="float">\n' \
+            '<text:p>{vPresentation}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vDatabase}" calcext:value-type="float">\n' \
+            '<text:p>{vDatabase}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vDrawing}" calcext:value-type="float">\n' \
+            '<text:p>{vDrawing}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vLibreOffice}" calcext:value-type="float">\n' \
+            '<text:p>{vLibreOffice}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vBorders}" calcext:value-type="float">\n' \
+            '<text:p>{vBorders}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vCrashes}" calcext:value-type="float">\n' \
+            '<text:p>{vCrashes}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vBasic}" calcext:value-type="float">\n' \
+            '<text:p>{vBasic}</text:p></table:table-cell>\n' \
+       '<table:table-cell/>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vWriter}" calcext:value-type="float">\n' \
+            '<text:p>{vWriter}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vMigration}" calcext:value-type="float">\n' \
+            '<text:p>{vMigration}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vChart}" calcext:value-type="float">\n' \
+            '<text:p>{vChart}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vExtensions}" calcext:value-type="float">\n' \
+            '<text:p>{vExtensions}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vFormula}" calcext:value-type="float">\n' \
+            '<text:p>{vFormula}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vImpressRemote}" calcext:value-type="float">\n' \
+            '<text:p>{vImpressRemote}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vInstallation}" calcext:value-type="float">\n' \
+            '<text:p>"{vInstallation}"</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vLinguistic}" calcext:value-type="float">\n' \
+            '<text:p>{vLinguistic}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vPrinting}" calcext:value-type="float">\n' \
+            '<text:p>{vPrinting}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vUI}" calcext:value-type="float">\n' \
+            '<text:p>{vUI}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vFilters}" calcext:value-type="float">\n' \
+            '<text:p>{vFilters}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vFramework}" calcext:value-type="float">\n' \
+            '<text:p>{vFramework}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vGraphics}" calcext:value-type="float">\n' \
+            '<text:p>{vGraphics}</text:p></table:table-cell>\n' \
+       '<table:table-cell office:value-type="float" office:value="{vSdk}" calcext:value-type="float">\n' \
+            '<text:p>{vSdk}</text:p></table:table-cell>\n' \
+       '<table:table-cell table:formula="of:=[.A258]" office:value-type="date" ' \
+            'office:date-value="2001-01-01" calcext:value-type="date">\n' \
+            '<text:p>2001-01-01</text:p></table:table-cell>\n' \
+       '<table:table-cell table:formula="of:=[.B258]-[.B257]" office:value-type="float" ' \
+            'office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell table:formula="of:=[.D258]-[.D257]" office:value-type="float" ' \
+            'office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell table:formula="of:=[.AE258]-[.AD258]" office:value-type="float" ' \
+            'office:value="-1" calcext:value-type="float">\n' \
+            '<text:p>-1</text:p></table:table-cell>\n' \
+       '<table:table-cell table:number-columns-repeated="24"/>\n' \
+       '</table:table-row>\n'.format(
+              vDate  = statList['addDate'],
+              vOpen  = statList['date']['esc']['QAstat'][''],
+              vTotal = 0,
+              vSpreadsheet = 0,
+              vPresentation = 0,
+              vDatabase = 0,
+              vDrawing = 0,
+              vLibreOffice = 0,
+              vBorders = 0,
+              vCrashes = 0,
+              vBasic = 0,
+              vWriter = 0,
+              vMigration = 0,
+              vChart = 0,
+              vExtensions = 0,
+              vFormula = 0,
+              vImpressRemote = 0,
+              vInstallation = 0,
+              vLinguistic = 0,
+              vPrinting = 0,
+              vUI = 0,
+              vFilters = 0,
+              vFramework = 0,
+              vGraphics = 0,
+              vSdk = 0
+    )
+
+
+    rowHighPrioRegressions = ''
+#    <table:table-row table:style-name="ro2">
+#     <table:table-cell table:style-name="ce14" office:value-type="date" office:date-value="2017-04-18" calcext:value-type="date">
+#      <text:p>2017-04-18</text:p>
+#     </table:table-cell>
+#     <table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
+#      <text:p>1</text:p>
+#     </table:table-cell>
+#     <table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="2" calcext:value-type="float">
+#      <text:p>2</text:p>
+#     </table:table-cell>
+#     <table:table-cell/>
+#     <table:table-cell office:value-type="float" office:value="4" calcext:value-type="float">
+#      <text:p>4</text:p>
+#     </table:table-cell>
+#     <table:table-cell table:number-columns-repeated="4"/>
+#     <table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
+#      <text:p>1</text:p>
+#     </table:table-cell>
+#     <table:table-cell table:number-columns-repeated="2"/>
+#     <table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
+#      <text:p>1</text:p>
+#     </table:table-cell>
+#     <table:table-cell table:number-columns-repeated="10"/>
+#    </table:table-row>
+
+    endIndex = 0
+    searchStartSheet = '<table:table table:name='
+    lenStartSheet = len(searchStartSheet)
+    while True:
+      startIndex = text.find(searchStartSheet, endIndex) + lenStartSheet
+      if startIndex <= lenStartSheet:
+        break
+      endIndex = text.find('</table:table>', startIndex)
+
+      if text[startIndex:].startswith('"local-table"'):
+        # no handling
+        continue
+      elif text[startIndex:].startswith('"Charts"'):
+        # no handling
+        continue
+      elif text[startIndex:].startswith('"Legacy"'):
+        # no handling
+        continue
+      elif text[startIndex:].startswith('"HighPriority"'):
+        inx  = text.rfind('<table:table-row table:style-name="ro2" table:number-rows-repeated="39">', startIndex, endIndex)
+        text = text[:inx] + '\n\n' + rowHighPriority + '\n\n' + text[inx:]
+      elif text[startIndex:].startswith('"Regressions"'):
+        print("handling Regressions")
+      elif text[startIndex:].startswith('"HighPrioRegressions"'):
+        print("handling HighPrioRegressions")
+      else:
+        raise Exception("unknown sheet in bug-metrics: " + text[startIndex:startIndex+20])
+      print('start: {}     end {}'.format(startIndex, endIndex))
+
+    fp = open(cfg['homedir'] + 'bug-test.fods', 'w', encoding='utf-8')
+    print(text, file=fp)
+    fp.close()
+    data = 'ESC bug_metric.fods, based on stats.json from '+statList['addDate']
     return {'title': data, 'mail': 'mentoring at documentfoundation.org', 'attach': '/tmp/esc_flatODF.fods', 'file' : '/tmp/esc_flatODF_body'}
 
 


More information about the Libreoffice-commits mailing list