Skip to content

Instantly share code, notes, and snippets.

@Jc2k
Jc2k / gist:1345508
Created November 7, 2011 16:56
Override the WebStatus to only
from buildbot.status.web.waterfall import WaterfallStatusResource
from buildbot.status.web.baseweb import WebStatus
class MyWebStatus(WebStatus):
def setupUsualPages(self, numbuilds, num_events, num_events_max):
self.setupUsualPages(numbuilds, num_events, num_events_max)
self.putChild("waterfall", WaterfallStatusResource(
@Jc2k
Jc2k / lazy.py
Created January 15, 2012 15:26
Lazier Django Settings
class RecurseLock(object):
"""
Maintain a stack of settings referenced by LazierSetting so we can trap recursion.
We use a context manager to surround variable access, and ensure that the stack is cleared.
Error message contains a stack trace::
Setting FOO was used recursively
FOO -> BAR -> BAZ -> FOO
@Jc2k
Jc2k / bootstrap.py
Created April 30, 2012 12:59
Buildout to install sqlite + pysqlite + buildbot (where distro sqlite is too old)
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
@Jc2k
Jc2k / README.rst
Created May 2, 2012 08:57
Buildout to run buildbot on python2.6 on distros without 2.6

Building Buildbot on systems with old Pythons

You will need the following development packages:

  • zlib-devel (zlib1g-dev)
  • bzip2-devel (libbz2-dev)

In a directory containing the buildout.cfg and bootstrap.py from this gist:

@Jc2k
Jc2k / example.py
Created May 28, 2012 15:37
Getting a successful build number into another build using renderables
class LastBuild(util.ComparableMixin):
"""
This code isn't meant to be functional!
It's really pseudo code for how i would the # of the last successful
build into a completely unrelated build - some digging around will
be required.
You are invited to explore the build.master API and see if there is
a better way to iterate previous builds - look for getLastFinishedBuild.
@Jc2k
Jc2k / example.py
Created June 8, 2012 00:46
isotoma.buildout.basicauth
class Unauthorized(Exception):
def __init__(self, code):
self.code = code
class BaseAdaptor(object):
retries = 10
adapts = None
@Jc2k
Jc2k / scriptedlatentslave.py
Created August 24, 2012 19:39
A generic latent slave for anything you can script
import os, shlex
from twisted.internet import defer, utils, reactor, threads
from twisted.python import log, failure
from buildbot.buildslave import AbstractBuildSlave, AbstractLatentBuildSlave
from buildbot import config
class ScriptedLatedBuildSlave(AbstractLatentBuildSlave):
@Jc2k
Jc2k / gist:3917334
Created October 19, 2012 10:17
Many waterfalls
from buildbot.status.web.waterfall import WaterfallStatusResource
from buildbot.status.web.baseweb import WebStatus
class MyWebStatus(WebStatus):
def setupUsualPages(self, numbuilds, num_events, num_events_max):
self.setupUsualPages(numbuilds, num_events, num_events_max)
self.putChild("waterfalls", WaterfallsResource(
num_events=num_events,
@Jc2k
Jc2k / buildslave.py
Created February 4, 2013 22:08
Workaround from svn
def _setBuildWaitTimer(self):
self._clearBuildWaitTimer()
if self.build_wait_timeout <= 0:
return
self.build_wait_timer = reactor.callLater(
self.build_wait_timeout, self._soft_disconnect)
@Jc2k
Jc2k / buildslave.py
Last active December 12, 2015 03:58
@defer.inlineCallbacks
def _soft_disconnect(self, fast=False):
if not self.build_wait_timeout < 0:
yield AbstractBuildSlave.disconnect(self)
return
if self.missing_timer:
self.missing_timer.cancel()
self.missing_timer = None