[pypy-commit] buildbot default: merge add-header-to-nightly

bivab noreply at buildbot.pypy.org
Mon Nov 18 23:01:07 CET 2013


Author: David Schneider <david.schneider at picle.org>
Branch: 
Changeset: r898:3f8d7754ec20
Date: 2013-11-18 23:00 +0100
http://bitbucket.org/pypy/buildbot/changeset/3f8d7754ec20/

Log:	merge add-header-to-nightly

diff --git a/bot2/pypybuildbot/pypylist.py b/bot2/pypybuildbot/pypylist.py
--- a/bot2/pypybuildbot/pypylist.py
+++ b/bot2/pypybuildbot/pypylist.py
@@ -5,7 +5,8 @@
 import cgi
 import urllib
 import sys
-from twisted.web.static import File, DirectoryLister
+from twisted.web.static import File, formatFileSize
+from buildbot.status.web.base import DirectoryLister
 
 class PyPyTarball(object):
 
@@ -142,98 +143,39 @@
         names = File.listNames(self)
         if is_pypy_dir(names):
             names = self.sortBuildNames(names)
-            Listener = PyPyDirectoryLister
         else:
             names = self.sortDirectoryNames(File.listEntities(self))
-            Listener = DirectoryLister
+        Listener = PyPyDirectoryLister
         return Listener(self.path,
                         names,
                         self.contentTypes,
                         self.contentEncodings,
                         self.defaultType)
 
-class NumpyStatusList(File):
-    pass
-
 class PyPyDirectoryLister(DirectoryLister):
-    template = """<html>
-<head>
-<title>%(header)s</title>
-<style>
-.even        { background-color: #eee    }
-.odd         { background-color: #dedede }
-.even-passed { background-color: #caffd8 }
-.odd-passed  { background-color: #a3feba }
-.even-failed { background-color: #ffbbbb }
-.odd-failed  { background-color: #ff9797 }
-
-.summary_link {
-    color: black;
-    text-decoration: none;
-}
-.summary_link:hover {
-    color: blue;
-    text-decoration: underline;
-}
-
-.icon { text-align: center }
-.listing {
-    margin-left: auto;
-    margin-right: auto;
-    width: 50%%;
-    padding: 0.1em;
-    }
-
-body { border: 0; padding: 0; margin: 0; background-color: #efefef; }
-h1 {padding: 0.1em; background-color: #777; color: white; border-bottom: thin white dashed;}
-td,th {padding-left: 0.5em; padding-right: 0.5em; }
-
-</style>
-</head>
-
-<body>
-<h1>%(header)s</h1>
-
-<table>
-    <thead>
-        <tr>
-            <th>Filename</th>
-            <th>Size</th>
-            <th>Date</th>
-            <th><i>own</i> tests</th>
-            <th><i>applevel</i> tests</th>
-        </tr>
-    </thead>
-    <tbody>
-%(tableContent)s
-    </tbody>
-</table>
-
-</body>
-</html>
-"""
-
-    linePattern = """<tr class="%(class)s">
-    <td><a href="%(href)s">%(text)s</a></td>
-    <td>%(size)s</td>
-    <td>%(date)s</td>
-    <td class="%(own_summary_class)s">%(own_summary)s</td>
-    <td class="%(app_summary_class)s">%(app_summary)s</td>
-</tr>
-"""
+    '''template based, uses master/templates/directory.html
+    '''
 
     def render(self, request):
         self.status = request.site.buildbot_service.getStatus()
         return DirectoryLister.render(self, request)
 
-    def _buildTableContent(self, elements):
-        tableContent = []
+    def _getFilesAndDirectories(self, directory):
+        dirs, files = DirectoryLister._getFilesAndDirectories(self, directory)
         rowClasses = itertools.cycle(['odd', 'even'])
-        for element, rowClass in zip(elements, rowClasses):
-            element["class"] = rowClass
-            self._add_test_results(element, rowClass)
-            tableContent.append(self.linePattern % element)
-        return tableContent
+        for f, rowClass in zip(files, rowClasses):
+            f["class"] = rowClass
+            self._add_test_results(f, rowClass)
+        for d in dirs:
+            dirname = urllib.unquote(d['href'])
+            dd = py.path.local(self.path).join(dirname)
+            date = datetime.date.fromtimestamp(dd.mtime())
+            d['date'] = date.isoformat()
+            # Assume dir is non-recursive
+            size = sum([f.size() for f in dd.listdir() if f.isfile()])
+            d['size'] = formatFileSize(size)
+
+        return dirs, files
 
     def _add_test_results(self, element, rowClass):
         filename = urllib.unquote(element['href'])
@@ -292,3 +234,6 @@
         else:
             return rowClass + '-failed'
 
+class NumpyStatusList(PyPyList):
+    pass
+
diff --git a/master/templates/directory.html b/master/templates/directory.html
new file mode 100644
--- /dev/null
+++ b/master/templates/directory.html
@@ -0,0 +1,94 @@
+{% extends "layout.html" %}
+{% block morehead %}
+<style>
+.even        { background-color: #eee    }
+.odd         { background-color: #dedede }
+.even-passed { background-color: #caffd8 }
+.odd-passed  { background-color: #a3feba }
+.even-failed { background-color: #ffbbbb }
+.odd-failed  { background-color: #ff9797 }
+
+.summary_link {
+    color: black;
+    text-decoration: none;
+}
+.summary_link:hover {
+    color: blue;
+    text-decoration: underline;
+}
+
+.icon { text-align: center }
+.listing {
+    margin-left: auto;
+    margin-right: auto;
+    width: 50%%%%;
+    padding: 0.1em;
+    }
+
+body { border: 0; padding: 0; margin: 0; background-color: #efefef; }
+td,th {padding-left: 0.5em; padding-right: 0.5em; }
+td:first-child {text-align: left;}
+
+</style>
+
+{% endblock %}
+
+{% block content %}
+
+<h1>Directory listing for {{ path }}</h1>
+
+{% set row_class = cycler('odd', 'even') %}
+
+{% set has_tests = files|join('', attribute='own_summary')|length > 0 or 
+      files|join('', attribute='app_summary')|length > 0 %}
+
+<table>
+
+{% if files|length > 0 %}
+<tr class="{{ row_class.next() }}">
+<th>Filename</th>
+<th>Size</th>
+<th>Date</th>
+{% if has_tests %}
+<th><i>own</i> tests</th>
+<th><i>applevel</i> tests</th>
+{% endif %}
+</tr>
+{% else %}
+<tr class="{{ row_class.next() }}">
+<th>Directory</th>
+<th>Size</th>
+<th>Date</th>
+{% if has_tests %}
+<th></th>
+<th></th>
+{% endif %}
+</tr>
+{% endif %}
+
+{% for d in directories %}
+  <tr class="{{ row_class.next() }}">
+    <td><a href="{{ d.href }}"><b>{{ d.text }}</b></a></td>
+    <td>{{ d.size}}</td>
+    <td>{{ d.date}}</td>
+{% if has_tests %}
+    <td></td>
+    <td></td>
+{% endif %}
+  </tr>
+{% endfor %}
+
+{% for f in files %}
+  <tr class="{{ f.class }}">
+    <td><a href="{{ f.href }}">{{ f.text }}</a></td>
+    <td>{{ f.size }}</td>
+    <td>{{ f.date }}</td>
+{% if has_tests %}
+    <td class="{{ f.own_summary_class }}">{{ f.own_summary }}</td>
+    <td class="{{ f.app_summary_class }}">{{ f.app_summary }}</td>
+{% endif %}
+  </tr>
+{% endfor %}
+</table>
+
+{% endblock %}
diff --git a/master/templates/layout.html b/master/templates/layout.html
--- a/master/templates/layout.html
+++ b/master/templates/layout.html
@@ -23,19 +23,19 @@
     {% block header -%}
     <div class="header">
         <a href="{{ path_to_root or '.' }}">Home</a>
-        -
         <!-- PyPy specific items -->
-        <a href="http://speed.pypy.org/">Speed</a>
-        <a href="{{ path_to_root }}summary?branch=<trunk>">Summary (trunk)</a>
-        <a href="{{ path_to_root }}summary">Summary</a>
-        <a href="{{ path_to_root }}nightly/">Nightly builds</a>
+        - <a href="http://speed.pypy.org/">Speed</a>
+        - <a href="{{ path_to_root }}numpy-status/">Numpy compatability</a>
+        - <a href="{{ path_to_root }}summary?branch=<trunk>">Summary (trunk)</a>
+        - <a href="{{ path_to_root }}summary">Summary</a>
+        - <a href="{{ path_to_root }}nightly/">Nightly builds</a>
         <!-- end of PyPy specific items -->
 
-        <a href="{{ path_to_root }}waterfall">Waterfall</a>
+        - <a href="{{ path_to_root }}waterfall">Waterfall</a>
         <!-- <a href="{{ path_to_root }}grid">Grid</a> -->
         <!-- <a href="{{ path_to_root }}tgrid">T-Grid</a> -->
         <!-- <a href="{{ path_to_root }}console">Console</a> -->
-        <a href="{{ path_to_root }}builders">Builders</a>
+        - <a href="{{ path_to_root }}builders">Builders</a>
         <!-- <a href="{{ path_to_root }}one_line_per_build">Recent Builds</a> -->
         <!-- <a href="{{ path_to_root }}buildslaves">Buildslaves</a> -->
         <!-- <a href="{{ path_to_root }}changes">Changesources</a> -->
diff --git a/requirements.txt b/requirements.txt
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,7 +10,7 @@
 buildbot-slave==0.8.6p1
 decorator==3.4.0
 mock==1.0.1
-py==1.4.9
+py==1.4.18
 pytest==2.2.4
 python-dateutil==1.5
 sqlalchemy-migrate==0.7.2


More information about the pypy-commit mailing list