Changeset: d58edda07abf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d58edda07abf
Added Files:
        testing/Mtest.py.in.old
Modified Files:
        testing/Mtest.py.in
Branch: mtest
Log Message:

clean up


diffs (truncated from 5541 to 300 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -419,150 +419,6 @@ CONDITIONALS = {
     'HAVE_IPV6'            : "",
 }
 
-# a bunch of classes to help with generating (X)HTML files
-class _Encode:
-    # mix-in class for encoding text and attribute values so that they
-    # don't get interpreted as something else by the browser
-    def encode(self, data, attr):
-        map = [('&', '&'),          # MUST be first
-               ('<', '&lt;'),
-               ('>', '&gt;'),
-               (None, None),
-               # following chars only translated in attr values (attr is True)
-               ('"', '&quot;'),
-               ('\t', '&#9;'),
-               ('\n', '&#10;'),
-               ('\r', '&#13;'),
-               ]
-        for c, tr in map:
-            if c is None:
-                if not attr:
-                    break
-                continue
-            data = data.replace(c, tr)
-        return data
-
-class Element(_Encode):
-    # class to represent an (X)HTML element with its attributes and
-    # children
-
-    # inline elements, we do not add newlines to the contents of these
-    # elements
-    inline = ['tt','i','b','big','small','em','strong','dfn','code',
-              'samp','kbd','var','cite','abbr','acronym','a','img',
-              'object','br','script','map','q','sub','sup','span',
-              'bdo','input','select','textarea','label','button','font']
-    # empty elements
-    empty = ['link', 'basefont', 'br', 'area', 'img', 'param', 'hr',
-             'input', 'col', 'frame', 'isindex', 'base', 'meta', ]
-    xml = True                          # write XHTML instead of HTML
-
-    def __init__(self, tag, attrdict = None, *children):
-        self.tag = tag
-        if attrdict is None:
-            attrdict = {}
-        self.attrdict = attrdict
-        if children is None:
-            children = []
-        self.isempty = tag.lower() in self.empty
-        if self.isempty:
-            if children:
-                raise ValueError("empty element can't have children")
-            self.children = None
-        else:
-            self.children = list(children)
-
-    def __str__(self):
-        # string representation of the element with its children
-        s = ['<%s' % self.tag]
-        for name, value in sorted(self.attrdict.items()):
-            s.append(' %s="%s"' % (name, self.encode(value, True)))
-        if self.children or (not self.xml and not self.isempty):
-            s.append('>')
-            for c in self.children:
-                s.append(str(c))
-            s.append('</%s>' % self.tag)
-        elif self.xml:
-            s.append('/>')
-        else:
-            s.append('>')               # empty HTML element
-        return ''.join(s)
-
-    def write(self, f, newline = False):
-        # write the element with its children to a file
-        # if newline is set, add newlines at strategic points
-        if self.tag.lower() == 'html':
-            # before we write the DOCTYPE we should really check
-            # whether the document conforms...
-            if self.xml:
-                f.write('<!DOCTYPE html PUBLIC '
-                        '"-//W3C//DTD XHTML 1.0 Transitional//EN"\n'
-                        '                      '
-                        
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>\n')
-            else:
-                f.write('<!DOCTYPE html PUBLIC '
-                        '"-//W3C//DTD HTML 4.01 Transitional//EN"\n'
-                        '                      '
-                        '"http://www.w3.org/TR/html4/loose.dtd";>\n')
-        inline = self.tag.lower() in self.inline
-        f.write('<%s' % self.tag)
-        for name, value in sorted(self.attrdict.items()):
-            f.write(' %s="%s"' % (name, self.encode(value, True)))
-        if self.children or (not self.xml and not self.isempty):
-            if not inline:
-                for c in self.children:
-                    if not isinstance(c, Element):
-                        inline = True
-                        break
-            f.write('>')
-            if newline and not inline:
-                f.write('\n')
-            for c in self.children:
-                c.write(f, newline and not inline)
-            f.write('</%s>' % self.tag)
-        elif self.xml:
-            f.write('/>')
-        else:
-            f.write('>')                # empty HTML element
-        if newline:
-            f.write('\n')
-
-    def addchild(self, child):
-        self.children.append(child)
-
-    def addchildren(self, children):
-        for child in children:
-            self.children.append(child)
-
-    def inschild(self, index, child):
-        self.children.insert(index, child)
-
-class Text(_Encode):
-    # class to represent text in (X)HTML
-    def __init__(self, text = '', raw = False):
-        self.text = text
-        self.raw = raw
-
-    def __str__(self):
-        if self.raw:
-            return self.text
-        return self.encode(self.text, False)
-
-    def write(self, f, newline = False):
-        f.write(str(self))
-        if newline and not self.raw:
-            f.write('\n')
-
-class Comment:
-    # class to represent an (X)HTML comment (not currently used)
-    def __init__(self, text):
-        self.text = text
-
-    def __str__(self):
-        return '<!--%s-->' % self.text
-
-    def write(self, f, newline = False):
-        f.write(str(self))
 
 class Timer:
     # interface to the threading.Timer function that interprets a
@@ -592,18 +448,6 @@ green = '#00aa00'
 darkgreen = '#005500'
 orange = '#ffaa00'
 purple = '#aa00aa'
-stylesheet = Element('style', None, Text('''
-.error     { font-weight: bold; font-style: italic; color: red; }
-.segfault  { font-weight: bold; font-style: italic; color: purple; }
-.abort     { font-weight: bold; font-style: italic; color: purple; }
-.recursion { font-weight: bold; font-style: italic; color: purple; }
-.timeout   { font-weight: bold; font-style: italic; color: purple; }
-.socket    { font-weight: bold; font-style: italic; color: purple; }
-.warning   { font-weight: bold; color: orange; }
-.good      {  }
-.header    { font-family: helvetica, arial; text-align: center; }
-.black     { color: black; }
-'''))
 
 TIMES = []
 
@@ -647,12 +491,6 @@ def startswithpath(str,pre) :
     return os.path.normcase(str[:len(pre)]) == os.path.normcase(pre)
 ### startswithpath(str,pre) #
 
-##def path(str) :
-##    return str.replace('/', os.sep)
-### path(str) #
-##def url(str) :
-##    return str.replace(os.sep, '/')
-### url(str) #
 if sys.version_info[0] == 2:
     import urllib
     path = urllib.url2pathname
@@ -684,456 +522,8 @@ def try_open(path, mode) :
     return f
 ###  try_open(path, mode) #
 
-def CreateHtmlIndex (env, *body) :
-    TSTDIR=env['TSTDIR']
-    TSTTRGDIR=env['TSTTRGDIR']
-
-    if TSTDIR:
-        INDEX=".index"
-    else:
-        INDEX="index"
-
-    if body:
-        BACK = os.getcwd()
-        os.chdir(TSTTRGDIR)
-
-        if TSTDIR:
-            header = Text(TSTDIR)
-            if URLPREFIX:
-                header = Element('a',
-                                 {'href': '%s%s/%s' % (URLPREFIX, url(TSTDIR), 
TSTSUFF),
-                                  'target': '%s_%s_body' % (DISTVER, TSTDIR),
-                                  'class': 'black'},
-                                 header)
-            tr = Element('tr', {'valign': 'top'},
-                         Element('th', {'class': 'header'},
-                                 header))
-            tr.addchildren(body)
-            hbody = Element('body',
-                            {'bgcolor': white,
-                             'text': black,
-                             'link': green,
-                             'vlink': darkgreen,
-                             'alink': lime},
-                            Element('center', {},
-                                    Element('table',
-                                            {'align': 'abscenter',
-                                             'border': '1',
-                                             'cellspacing': '0',
-                                             'cellpadding': '3'},
-                                            tr)))
-        else:
-            header = Element('h3', {},
-                             Text(DISTVER))
-            hbody = Element('body',
-                            {'bgcolor': white,
-                             'text': black,
-                             'link': green,
-                             'vlink': darkgreen,
-                             'alink': lime},
-                            header)
-            hbody.addchildren(body)
-        html = Element('html', {},
-                       Element('head', {},
-                               Element('meta', {'charset':'utf8'}),
-                               Element('title', {}, Text(HTMLTITLE)),
-                               stylesheet),
-                       hbody)
-        f = openutf8("%s.head.html" % INDEX,"w")
-        html.write(f, True)
-        f.close()
-
-        if TSTDIR:
-            layout = 'rows'
-            ROWS="8%"
-        else:
-            layout = 'cols'
-            ROWS="10%"
-        html = Element('html', {},
-                       Element('head', {},
-                               Element('meta', {'charset':'utf8'}),
-                               Element('title', {}, Text(HTMLTITLE))),
-                       Element('frameset',
-                               {layout: '%s,*' % ROWS,
-                                'frameborder': 'yes',
-                                'border': '1',
-                                'bordercolor': white,
-                                'marginwidth': '0',
-                                'marginheight': '0'},
-                               Element('frame',
-                                       {'src': '%s.head.html' % INDEX,
-                                        'scrolling': 'auto',
-                                        'name': '%s_%s_head' % (DISTVER, 
TSTDIR),
-                                        'frameborder': 'yes',
-                                        'bordercolor': white,
-                                        'marginwidth': '0',
-                                        'marginheight': '0'}),
-                               Element('frame',
-                                       {'src': url(env['_%s_BODY_' % 
TSTDIR][0]),
-                                        'scrolling': 'auto',
-                                        'name': '%s_%s_body' % (DISTVER, 
TSTDIR),
-                                        'frameborder': 'yes',
-                                        'bordercolor': white,
-                                        'marginwidth': '0',
-                                        'marginheight': '0'})))
-        f = openutf8("%s.html" % INDEX, "w")
-        html.write(f, True)
-        f.close()
-        env['_%s_BODY_' % TSTDIR] = ["", 0]
-        os.chdir(BACK)
-### CreateHtmlIndex (env, *body) #
-
 bugre = re.compile(r'\.(sf|bug)-(?P<bugno>[1-9]\d+)', re.I)
 
-def CreateTstWhatXhtml (env, TST, stableWHAT, EXT, result) :
-    WHAT = stableWHAT[7:11]
-    TSTDIR    = env['TSTDIR']
-    TSTSRCDIR = env['TSTSRCDIR']
-
-    if result == F_OK:
-        diffclass = 'good'
-        difftext = 'No differences'
-    elif result == F_WARN:
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to