[Buildbot-commits] buildbot/buildbot/status builder.py,1.46,1.47

Brian Warner warner at users.sourceforge.net
Fri Apr 1 01:01:15 UTC 2005


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

Modified Files:
	builder.py 
Log Message:
(BuildStatus.saveYourself): under w32, don't unlink the file unless it
already exists. Thanks to Baptiste Lepilleur for the catch.
(BuilderStatus.saveYourself): same


Index: builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/builder.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- builder.py	3 Dec 2004 22:54:52 -0000	1.46
+++ builder.py	1 Apr 2005 01:01:12 -0000	1.47
@@ -795,7 +795,8 @@
                 # fall back to delete-first. There are ways this can fail and
                 # lose the builder's history, so we avoid using it in the
                 # general (non-windows) case
-                os.unlink(filename)
+                if os.path.exists(filename):
+                    os.unlink(filename)
             os.rename(tmpfilename, filename)
         except:
             log.msg("unable to save build %s-#%d" % (self.builder.name,
@@ -884,7 +885,8 @@
             pickle.dump(self, open(tmpfilename, "w"), -1)
             if sys.platform == 'win32':
                 # windows cannot rename a file on top of an existing one
-                os.unlink(filename)
+                if os.path.exists(filename):
+                    os.unlink(filename)
             os.rename(tmpfilename, filename)
         except:
             log.msg("unable to save builder %s" % self.name)





More information about the Commits mailing list