[Checkins] SVN: zopetoolkit/doc/ Adding server side buildbot colors

Patrick Gerken do3ccqrv at gmail.com
Tue Sep 14 09:15:41 EDT 2010


Log message for revision 116382:
  Adding server side buildbot colors
  
  Also, added a new target in the
  makefile, run quickhtml to generate html
  docs without querying buildbots
  

Changed:
  U   zopetoolkit/doc/Makefile
  U   zopetoolkit/doc/buildout.cfg
  A   zopetoolkit/doc/source/_static/nosuccess.png
  A   zopetoolkit/doc/source/_static/success.png
  U   zopetoolkit/doc/source/_static/ztk.css
  U   zopetoolkit/doc/source/conf.py
  U   zopetoolkit/doc/source/process/buildbots.rst
  A   zopetoolkit/doc/src/
  A   zopetoolkit/doc/src/ztksphinx.py

-=-
Modified: zopetoolkit/doc/Makefile
===================================================================
--- zopetoolkit/doc/Makefile	2010-09-14 13:00:17 UTC (rev 116381)
+++ zopetoolkit/doc/Makefile	2010-09-14 13:15:40 UTC (rev 116382)
@@ -18,6 +18,7 @@
 help:
 	@echo "Please use \`make <target>' where <target> is one of"
 	@echo "  html      to make standalone HTML files"
+	@echo "  quickhtml to make standalone HTML files without buildbot data"
 	@echo "  pickle    to make pickle files"
 	@echo "  json      to make JSON files"
 	@echo "  htmlhelp  to make HTML files and a HTML help project"
@@ -37,6 +38,12 @@
 	@echo
 	@echo "Build finished. The HTML pages are in build/html."
 
+quickhtml:
+	mkdir -p build/html build/doctrees
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) -D buildbot_check=False build/html
+	@echo
+	@echo "Build finished. The HTML pages are in build/html."
+
 pickle:
 	mkdir -p build/pickle build/doctrees
 	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle

Modified: zopetoolkit/doc/buildout.cfg
===================================================================
--- zopetoolkit/doc/buildout.cfg	2010-09-14 13:00:17 UTC (rev 116381)
+++ zopetoolkit/doc/buildout.cfg	2010-09-14 13:15:40 UTC (rev 116382)
@@ -4,10 +4,12 @@
 [py]
 recipe = zc.recipe.egg
 interpreter = py
+extra-paths=src
 eggs = sphinx
        docutils
 
 [doc]
 recipe = zc.recipe.egg
+extra-paths=src
 eggs = sphinx
        docutils

Added: zopetoolkit/doc/source/_static/nosuccess.png
===================================================================
(Binary files differ)


Property changes on: zopetoolkit/doc/source/_static/nosuccess.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: zopetoolkit/doc/source/_static/success.png
===================================================================
(Binary files differ)


Property changes on: zopetoolkit/doc/source/_static/success.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: zopetoolkit/doc/source/_static/ztk.css
===================================================================
--- zopetoolkit/doc/source/_static/ztk.css	2010-09-14 13:00:17 UTC (rev 116381)
+++ zopetoolkit/doc/source/_static/ztk.css	2010-09-14 13:15:40 UTC (rev 116382)
@@ -10,3 +10,23 @@
 table.packagelist {
     width: 100%;
 }
+
+div#build-servers table ul {
+    padding-left: 0px;
+}
+
+div#build-servers table li {
+    list-style: none inside none;
+}
+
+.tests_passed {
+    background-image: url("../_static/success.png");
+    background-repeat: no-repeat;
+    padding-left: 18px;
+}
+
+.tests_not_passed {
+    background-image: url("../_static/nosuccess.png");
+    background-repeat: no-repeat;
+    padding-left: 18px;
+}

Modified: zopetoolkit/doc/source/conf.py
===================================================================
--- zopetoolkit/doc/source/conf.py	2010-09-14 13:00:17 UTC (rev 116381)
+++ zopetoolkit/doc/source/conf.py	2010-09-14 13:15:40 UTC (rev 116382)
@@ -26,7 +26,7 @@
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = []
+extensions = ['ztksphinx']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']

Modified: zopetoolkit/doc/source/process/buildbots.rst
===================================================================
--- zopetoolkit/doc/source/process/buildbots.rst	2010-09-14 13:00:17 UTC (rev 116381)
+++ zopetoolkit/doc/source/process/buildbots.rst	2010-09-14 13:15:40 UTC (rev 116382)
@@ -71,19 +71,19 @@
     * - `Zope 2.12 <http://svn.zope.org/Zope/branches/2.12>`__
       - unsupported
       - unsupported
-      - `The Health Agency <http://dev.thehealthagency.com/buildbot/builders/zope2.12%20slave-osx>`__
+      - .. buildbotresult:: http://dev.thehealthagency.com/buildbot/builders/zope2.12%20slave-osx The Health Agency 
       - unsupported
 
     * - `Zope 2 trunk <http://svn.zope.org/Zope/trunk>`__
       - unsupported
       - unsupported
-      - `The Health Agency <http://dev.thehealthagency.com/buildbot/builders/zope2%20slave-osx>`__
+      - .. buildbotresult:: http://dev.thehealthagency.com/buildbot/builders/zope2%20slave-osx The Health Agency 
       -
 
     * - `ZTK trunk <http://svn.zope.org/zopetoolkit/trunk>`__
       -
       -
-      - `The Health Agency <http://dev.thehealthagency.com/buildbot/builders/ztk%20slave-osx>`__
+      - .. buildbotresult:: http://dev.thehealthagency.com/buildbot/builders/ztk%20slave-osx The Health Agency
       -
 
 Windows
@@ -106,43 +106,44 @@
 
     * - `ZODB trunk <http://svn.zope.org/ZODB/trunk>`__
       - unsupported
-      - `winbot <http://winbot.zope.org/builders/ZODB_dev%20py_254_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ZODB_dev%20py_265_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ZODB_dev%20py_270_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ZODB_dev%20py_265_win64>`__
-      - `winbot <http://winbot.zope.org/builders/ZODB_dev%20py_270_win64>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/ZODB_dev%20py_254_win32 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ZODB_dev%20py_265_win32 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ZODB_dev%20py_270_win32 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ZODB_dev%20py_265_win64 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ZODB_dev%20py_270_win64 winbot 
 
     * - `ZTK 1.0 <http://svn.zope.org/zopetoolkit/trunk>`__
-      - `winbot <http://winbot.zope.org/builders/ztk_10%20py_244_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ztk_10%20py_254_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ztk_10%20py_265_win32>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_10%20py_244_win32 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_10%20py_254_win32 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_10%20py_265_win32 winbot 
       - notyet
-      - `winbot <http://winbot.zope.org/builders/ztk_10%20py_265_win32>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_10%20py_265_win32 winbot 
       - notyet
 
     * - `ZTK trunk <http://svn.zope.org/zopetoolkit/trunk>`__
-      - `winbot <http://winbot.zope.org/builders/ztk_dev%20py_244_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ztk_dev%20py_254_win32>`__
-      - `winbot <http://winbot.zope.org/builders/ztk_dev%20py_265_win32>`__, `The Health Agency <http://dev.thehealthagency.com/buildbot/builders/ztk_win%20slave-win>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_dev%20py_244_win32 winbot 
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_dev%20py_254_win32 winbot 
+      - * .. buildbotresult:: http://winbot.zope.org/builders/ztk_dev%20py_265_win32 winbot 
+        * .. buildbotresult:: http://dev.thehealthagency.com/buildbot/builders/ztk_win%20slave-win The Health Agency
       - notyet
-      - `winbot <http://winbot.zope.org/builders/ztk_dev%20py_265_win64>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/ztk_dev%20py_265_win64 winbot 
       - notyet
 
     * - `zc.buildout trunk <http://svn.zope.org/zc.buildout/trunk>`__
-      - `winbot <http://winbot.zope.org/builders/zc_buildout_dev%20py_244_win32>`__
-      - `winbot <http://winbot.zope.org/builders/zc_buildout_dev%20py_254_win32>`__
-      - `winbot <http://winbot.zope.org/builders/zc_buildout_dev%20py_265_win32>`__
-      - `winbot <http://winbot.zope.org/builders/zc_buildout_dev%20py_270_win32>`__
-      - `winbot <http://winbot.zope.org/builders/zc_buildout_dev%20py_265_win64>`__
-      - `winbot <http://winbot.zope.org/builders/zc_buildout_dev%20py_270_win64>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/zc_buildout_dev%20py_244_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/zc_buildout_dev%20py_254_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/zc_buildout_dev%20py_265_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/zc_buildout_dev%20py_270_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/zc_buildout_dev%20py_265_win64 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/zc_buildout_dev%20py_270_win64 winbot
 
     * - `Bluebream <http://svn.zope.org/bluebream/trunk>`__
-      - `winbot <http://winbot.zope.org/builders/BlueBream_dev%20py_244_win32>`__
-      - `winbot <http://winbot.zope.org/builders/BlueBream_dev%20py_254_win32>`__
-      - `winbot <http://winbot.zope.org/builders/BlueBream_dev%20py_265_win32>`__
-      - `winbot <http://winbot.zope.org/builders/BlueBream_dev%20py_270_win32>`__
-      - `winbot <http://winbot.zope.org/builders/BlueBream_dev%20py_265_win64>`__
-      - `winbot <http://winbot.zope.org/builders/BlueBream_dev%20py_270_win64>`__
+      - .. buildbotresult:: http://winbot.zope.org/builders/BlueBream_dev%20py_244_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/BlueBream_dev%20py_254_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/BlueBream_dev%20py_265_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/BlueBream_dev%20py_270_win32 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/BlueBream_dev%20py_265_win64 winbot
+      - .. buildbotresult:: http://winbot.zope.org/builders/BlueBream_dev%20py_270_win64 winbot
 
 Linux
 ~~~~~
@@ -182,11 +183,12 @@
     * - `Zope 2.12 <http://svn.zope.org/Zope/branches/2.12>`__
       - unsupported
       - unsupported
-      - `The Health Agency <http://dev.thehealthagency.com/buildbot/builders/zope2.12%20slave-ubuntu32>`__
+      - .. buildbotresult:: http://dev.thehealthagency.com/buildbot/builders/zope2.12%20slave-ubuntu32 The Health Agency 
       - unsupported
       - unsupported
       - unsupported
-      - EPY, `The Health Agency <http://dev.thehealthagency.com/buildbot/builders/zope2.12%20slave-ubuntu64>`__
+      - * EPY,
+        * .. buildbotresult:: http://dev.thehealthagency.com/buildbot/builders/zope2.12%20slave-ubuntu64 The Health Agency
       - unsupported
 
     * - `Zope 2 trunk <http://svn.zope.org/Zope/trunk>`__
@@ -200,12 +202,14 @@
       -
 
     * - `Zope 3.4 KGS <http://svn.zope.org/zope.release/branches/3.4>`__
-      - `POV <http://zope3.pov.lt/buildbot/builders/py2.4-32bit-linux>`__
-      - `POV <http://zope3.pov.lt/buildbot/builders/py2.5-32bit-linux>`__
+      - .. buildbotresult:: http://zope3.pov.lt/buildbot/builders/py2.4-32bit-linux POV 
+      - .. buildbotresult:: http://zope3.pov.lt/buildbot/builders/py2.5-32bit-linux POV 
       -
       -
-      - `AFPY <http://buildbot.afpy.org/kgs3.4/builders/Python2.4.6%2064bit%20linux>`__, `POV <http://zope3.pov.lt/buildbot/builders/py2.4-64bit-linux/>`__
-      - `AFPY <http://buildbot.afpy.org/kgs3.4/builders/Python2.5.5%2064bit%20linux>`__, `POV <http://zope3.pov.lt/buildbot/builders/py2.5-64bit-linux>`__
+      - * .. buildbotresult:: http://buildbot.afpy.org/kgs3.4/builders/Python2.4.6%2064bit%20linux AFPY 
+        * .. buildbotresult:: http://zope3.pov.lt/buildbot/builders/py2.4-64bit-linux/ POV 
+      - * .. buildbotresult:: http://buildbot.afpy.org/kgs3.4/builders/Python2.5.5%2064bit%20linux AFPY 
+        * .. buildbotresult:: http://zope3.pov.lt/buildbot/builders/py2.5-64bit-linux POV 
       -
       -
 
@@ -214,30 +218,30 @@
       -
       -
       -
-      - `AFPY <http://buildbot.afpy.org/ztk1.0/builders/Python2.4.6%20Linux%2064bit>`__
-      - `AFPY <http://buildbot.afpy.org/ztk1.0/builders/Python2.5.5%20Linux%2064bit>`__
-      - `AFPY <http://buildbot.afpy.org/ztk1.0/builders/Python2.6.5%20Linux%2064bit>`__
-      - `AFPY <http://buildbot.afpy.org/ztk1.0/builders/Python2.7.0%20Linux%2064bit>`__
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0/builders/Python2.4.6%20Linux%2064bit AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0/builders/Python2.5.5%20Linux%2064bit AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0/builders/Python2.6.5%20Linux%2064bit AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0/builders/Python2.7.0%20Linux%2064bit AFPY 
 
     * - `ZTK trunk <http://svn.zope.org/zopetoolkit/trunk>`_
       -
       -
       -
       -
-      - `AFPY <http://buildbot.afpy.org/ztk1.0dev/builders/Python2.4.6%20Linux%2064bit>`__
-      - `AFPY <http://buildbot.afpy.org/ztk1.0dev/builders/Python2.5.5%20Linux%2064bit>`__
-      - `AFPY <http://buildbot.afpy.org/ztk1.0dev/builders/Python2.6.5%20Linux%2064bit>`__
-      - `AFPY <http://buildbot.afpy.org/ztk1.0dev/builders/Python2.7.0%20Linux%2064bit>`__
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0dev/builders/Python2.4.6%20Linux%2064bit AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0dev/builders/Python2.5.5%20Linux%2064bit AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0dev/builders/Python2.6.5%20Linux%2064bit AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/ztk1.0dev/builders/Python2.7.0%20Linux%2064bit AFPY 
 
     * - `Bluebream <http://svn.zope.org/bluebream/trunk>`__
       -
       -
       -
       -
-      - `AFPY <http://buildbot.afpy.org/bluebream/builders/Python2.4.6%2064bit%20linux>`__
-      - `AFPY <http://buildbot.afpy.org/bluebream/builders/Python2.5.5%2064bit%20linux>`__
-      - `AFPY <http://buildbot.afpy.org/bluebream/builders/Python2.6.5%2064bit%20linux>`__
-      - `AFPY <http://buildbot.afpy.org/bluebream/builders/Python2.7.0%2064bit%20linux>`__
+      - .. buildbotresult:: http://buildbot.afpy.org/bluebream/builders/Python2.4.6%2064bit%20linux AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/bluebream/builders/Python2.5.5%2064bit%20linux AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/bluebream/builders/Python2.6.5%2064bit%20linux AFPY 
+      - .. buildbotresult:: http://buildbot.afpy.org/bluebream/builders/Python2.7.0%2064bit%20linux AFPY 
 
 The Buildbot Maintainers
 ~~~~~~~~~~~~~~~~~~~~~~~~

Added: zopetoolkit/doc/src/ztksphinx.py
===================================================================
--- zopetoolkit/doc/src/ztksphinx.py	                        (rev 0)
+++ zopetoolkit/doc/src/ztksphinx.py	2010-09-14 13:15:40 UTC (rev 116382)
@@ -0,0 +1,68 @@
+from random import random
+from docutils import nodes
+from sphinx.util.compat import Directive, make_admonition
+from xmlrpclib import ServerProxy
+
+import urllib
+import socket
+
+def setup(app):
+    app.add_config_value('buildbot_check', True, 'html')
+    app.add_node(BuildbotColor,
+                 html=(visit_buildbot_node, depart_buildbot_node))
+    app.connect('doctree-resolved', process_buildbot_nodes)
+    app.add_directive('buildbotresult', BuildbotDirective)
+
+class BuildbotDirective(Directive):
+
+    has_content = True
+    required_arguments = 1
+    optional_arguments = 1
+    final_argument_whitespace = True
+
+    def run(self):
+        buildbot_url = self.arguments[0]
+        text = self.arguments[1]
+        targetnode = BuildbotColor('', '')
+        targetnode.text = text
+        targetnode.buildbot_url = buildbot_url
+
+        return [targetnode]
+
+def process_buildbot_nodes(app, doctree, fromdocname):
+    if app.config.buildbot_check:
+        socket_timeout = socket.getdefaulttimeout()
+        try:
+            socket.setdefaulttimeout(min(socket_timeout, 5))
+            for node in doctree.traverse(BuildbotColor):
+                buildbot_url = node.buildbot_url
+                buildbot_result = getBuildbotResult(buildbot_url)
+                css_class = buildbot_result and 'tests_passed' or \
+                    'tests_not_passed'
+                node.css_class = css_class
+        finally:
+            socket.setdefaulttimeout(socket_timeout)
+
+def getBuildbotResult(url):
+    try:
+        xmlrpc_url = '/'.join(url.split('/')[:-2] + ['xmlrpc'])
+        builder = urllib.unquote(url.split('/')[-1])
+        xmlrpc = ServerProxy(xmlrpc_url)
+        return xmlrpc.getLastBuildResults(builder) == 'success'
+    except:
+        return False
+
+class BuildbotColor(nodes.Inline, nodes.TextElement):
+    pass
+
+def visit_buildbot_node(self, node):
+    kwargs = {'href' : node.buildbot_url}
+    css_class = getattr(node, 'css_class', '')
+    if css_class:
+        kwargs['CLASS'] = css_class
+    self.body.append(self.starttag(node, 'a', **kwargs))
+    self.body.append(node.text)
+
+def depart_buildbot_node(self, node):
+    self.body.append('</a>')
+



More information about the checkins mailing list