[Buildbot-commits] buildbot/buildbot/changes changes.py,1.20,1.21

Brian Warner warner at users.sourceforge.net
Wed Apr 27 20:35:29 UTC 2005


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

Modified Files:
	changes.py 
Log Message:
(ChangeMaster.saveYourself): accomodate win32 which can't do atomic-rename


Index: changes.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/changes.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- changes.py	23 Apr 2005 10:22:10 -0000	1.20
+++ changes.py	27 Apr 2005 20:35:27 -0000	1.21
@@ -1,7 +1,7 @@
 #! /usr/bin/python
 
 from __future__ import generators
-import string, os, os.path, time, types
+import string, sys, os, os.path, time, types
 try:
     import cPickle as pickle
 except ImportError:
@@ -240,6 +240,10 @@
         tmpfilename = filename + ".tmp"
         try:
             pickle.dump(self, open(tmpfilename, "w"))
+            if sys.platform == 'win32':
+                # windows cannot rename a file on top of an existing one
+                if os.path.exists(filename):
+                    os.unlink(filename)
             os.rename(tmpfilename, filename)
         except Exception, e:
             log.msg("unable to save changes")





More information about the Commits mailing list