[Checkins] SVN: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py gotta use tempfile.mktemp

Adam Groszer agroszer at gmail.com
Tue Jun 15 13:06:16 EDT 2010


Log message for revision 113498:
  gotta use tempfile.mktemp

Changed:
  U   Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py

-=-
Modified: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py
===================================================================
--- Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py	2010-06-15 16:42:33 UTC (rev 113497)
+++ Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py	2010-06-15 17:06:15 UTC (rev 113498)
@@ -78,12 +78,12 @@
 
         LOGGER.debug('Running: %s\nIn: %s', command, sourceFolder)
 
+        tmpfile = None
         if len(command.splitlines()) > 1:
             #in case there are more lines we got to do .bat file
-            tmpfile = tempfile.NamedTemporaryFile(suffix='.bat')
-            tmpfile.write(command)
-            tmpfile.file.flush()
-            command = tmpfile.name
+            tmpfile = tempfile.mktemp(suffix='.bat')
+            open(tmpfile, "w").write(command)
+            command = tmpfile
 
         try:
             #this ought to build and upload the egg
@@ -104,6 +104,9 @@
             LOGGER.exception("An error occurred while running the build command")
             #continue without bailing out
 
+        if tmpfile:
+            os.remove(tmpfile)
+
 def versionToTuple(version):
     #tries to do "3.4.0" -> ('0003','0004','0000')
     #otherwise the problem starts with 3.10.0, that would be less than 3.4.0



More information about the checkins mailing list