[Buildbot-commits] buildbot/buildbot/status builder.py,1.71,1.72

Brian Warner warner at users.sourceforge.net
Sat Nov 5 22:53:02 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4430/buildbot/status

Modified Files:
	builder.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-416
Creator:  Brian Warner <warner at lothar.com>

use binary mode when opening pickle files, for windows

	* buildbot/changes/changes.py (ChangeMaster.saveYourself): use
	binary mode when opening pickle files, to make windows work
	better. Thanks to Dobes Vandermeer for the catch.
	* buildbot/status/builder.py (BuildStatus.saveYourself): same
	(BuilderStatus.getBuildByNumber): same
	(Status.builderAdded): same
	* buildbot/master.py (BuildMaster.loadChanges): same

	* buildbot/util.py (Swappable): delete unused leftover code


Index: builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/builder.py,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- builder.py	5 Nov 2005 21:06:15 -0000	1.71
+++ builder.py	5 Nov 2005 22:53:00 -0000	1.72
@@ -1246,7 +1246,7 @@
             shutils.rmtree(filename, ignore_errors=True)
         tmpfilename = filename + ".tmp"
         try:
-            pickle.dump(self, open(tmpfilename, "w"), -1)
+            pickle.dump(self, open(tmpfilename, "wb"), -1)
             if sys.platform == 'win32':
                 # windows cannot rename a file on top of an existing one, so
                 # fall back to delete-first. There are ways this can fail and
@@ -1378,7 +1378,7 @@
         filename = os.path.join(self.basedir, "builder")
         tmpfilename = filename + ".tmp"
         try:
-            pickle.dump(self, open(tmpfilename, "w"), -1)
+            pickle.dump(self, open(tmpfilename, "wb"), -1)
             if sys.platform == 'win32':
                 # windows cannot rename a file on top of an existing one
                 if os.path.exists(filename):
@@ -1407,7 +1407,7 @@
                 return build
         filename = os.path.join(self.basedir, "%d" % number)
         try:
-            build = pickle.load(open(filename, "r"))
+            build = pickle.load(open(filename, "rb"))
             styles.doUpgrade()
             build.builder = self
             # handle LogFiles from after 0.5.0 and before 0.6.5
@@ -1847,7 +1847,7 @@
         log.msg("trying to load status pickle from %s" % filename)
         builder_status = None
         try:
-            builder_status = pickle.load(open(filename, "r"))
+            builder_status = pickle.load(open(filename, "rb"))
             styles.doUpgrade()
         except IOError:
             log.msg("no saved status pickle, creating a new one")





More information about the Commits mailing list