[Buildbot-devel] Some questions/problems running latest build bot source on Windows
Brian Warner
warner-buildbot at lothar.com
Mon Nov 8 21:23:18 UTC 2004
> However, here is something that will work on NT-based Windows systems
> (Win2K, XP, etc.), but not on Win95:
> win32api.MoveFileEx(src, dst, win32con.MOVEFILE_REPLACE_EXISTING)
Eyah. Ok, I think I'll go with the os.unlink approach, since the most likely
failure case is when the filesystem is full, in which case the pickle will
fail first. I've committed the change, it may be a few hours before it shows
up on sf.net's anonymous-cvs, so I've attached the patch.
-Brian
-------------- next part --------------
Index: buildbot/status/builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/builder.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- buildbot/status/builder.py 15 Oct 2004 16:59:44 -0000 1.39
+++ buildbot/status/builder.py 8 Nov 2004 21:19:39 -0000 1.40
@@ -757,7 +757,12 @@
tmpfilename = filename + ".tmp"
try:
pickle.dump(self, open(tmpfilename, "w"), -1)
- os.rename(tmpfilename, filename)
+ try:
+ os.rename(tmpfilename, filename)
+ except OSError:
+ # windows cannot rename a file on top of an existing one
+ os.unlink(filename)
+ os.rename(tmpfilename, filename)
except Exception, e:
log.msg("unable to save build %s-#%d" % (self.builder.name,
self.number))
@@ -843,7 +848,12 @@
tmpfilename = filename + ".tmp"
try:
pickle.dump(self, open(tmpfilename, "w"), -1)
- os.rename(tmpfilename, filename)
+ try:
+ os.rename(tmpfilename, filename)
+ except OSError:
+ # windows cannot rename a file on top of an existing one
+ os.unlink(filename)
+ os.rename(tmpfilename, filename)
except Exception, e:
log.msg("unable to save builder %s" % self.name)
log.err()
More information about the devel
mailing list