I use buildbot to manage our labs build/testing infrastructure. I wrote up a guide a while back on how to set it up on different platforms. In this post I wanted to document how to keep the setup updated.
Note: If using a sandbox first source that sandbox
source sandbox/bin/activate
Update using pip
Using a shell command
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U
Using a python file
import pip
from subprocess import call
for dist in pip . get_installed_distributions ():
call ( "pip install --upgrade " + dist . project_name , shell = True )
Update using easy_install
Using a python file
#!/usr/bin/env python
from setuptools.command.easy_install import main as install
from pkg_resources import Environment , working_set
import sys
#Packages managed by setuptools
plist = [ dist . key for dist in working_set ]
def autoUp ():
for p in Environment ():
try :
install ([ '-U' , '-v' ] + [ p ])
except :
print "Update of % s failed!" % p
print "Done!"
def stepUp ():
for p in Environment ():
a = raw_input ( "updating % s, confirm? (y/n)" % p )
if a == 'y' :
try :
install ([ '-U' ] + [ p ])
except :
print "Update of % s failed!" % p
else :
print "Skipping % s" % p
print "Done!"
print "You have % s packages currently managed through Easy_install" % len ( plist )
print plist
ans = raw_input ( 'Do you want to update them... (N)ot at all, (O)ne-by-one, (A)utomatically (without prompting)' )
if ans == 'N' :
sys . exit ()
elif ans == 'O' :
stepUp ()
elif ans == 'A' :
autoUp ()
else :
pass