changeset 8183:4b11a0983557

fixed issue with deleting temp files on Windows
author Doug Simon <doug.simon@oracle.com>
date Fri, 08 Mar 2013 16:57:46 +0100
parents e0db99483b35
children 3bbdf34536bc
files mx/commands.py mxtool/mx.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Fri Mar 08 15:58:08 2013 +0100
+++ b/mx/commands.py	Fri Mar 08 16:57:46 2013 +0100
@@ -386,8 +386,9 @@
             jreLibDir = join(jdks, e, 'jre', 'lib')
             if exists(jreLibDir):
                 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE
-                _, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir)
+                fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir)
                 shutil.copyfile(graalJar, tmp)
+                os.close(fd)
                 shutil.move(tmp, join(jreLibDir, 'graal.jar'))
 
 # run a command in the windows SDK Debug Shell
--- a/mxtool/mx.py	Fri Mar 08 15:58:08 2013 +0100
+++ b/mxtool/mx.py	Fri Mar 08 16:57:46 2013 +0100
@@ -1651,7 +1651,7 @@
         if name.startswith('@'):
             dname = name[1:]
             d = distribution(dname)
-            _, tmp = tempfile.mkstemp(suffix='', prefix=basename(d.path), dir=dirname(d.path))
+            fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(d.path) + '.', dir=dirname(d.path))
             zf = zipfile.ZipFile(tmp, 'w')
             for p in sorted_deps(d.deps):
                 outputDir = p.output_dir()
@@ -1661,6 +1661,7 @@
                         arcname = join(relpath, f).replace(os.sep, '/')
                         zf.write(join(root, f), arcname)
             zf.close()
+            os.close(fd)
             # Atomic on Unix
             shutil.move(tmp, d.path)
             #print time.time(), 'move:', tmp, '->', d.path
@@ -1669,7 +1670,7 @@
         else:
             p = project(name)
             outputDir = p.output_dir()
-            _, tmp = tempfile.mkstemp(suffix='', prefix=p.name, dir=p.dir)
+            fd, tmp = tempfile.mkstemp(suffix='', prefix=p.name, dir=p.dir)
             zf = zipfile.ZipFile(tmp, 'w')
             for root, _, files in os.walk(outputDir):
                 for f in files:
@@ -1677,6 +1678,7 @@
                     arcname = join(relpath, f).replace(os.sep, '/')
                     zf.write(join(root, f), arcname)
             zf.close()
+            os.close(fd)
             # Atomic on Unix
             shutil.move(tmp, join(p.dir, p.name + '.jar'))
 
@@ -2184,7 +2186,7 @@
                        
         if projToDist.has_key(p.name):
             dist, distDeps = projToDist[p.name]
-            _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist.launch', 'archive @' + dist.name, refresh=False, async=True, logToConsole=True)
+            _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist.launch', 'archive @' + dist.name, refresh=False, async=True)
         
         out.close('buildSpec')
         out.open('natures')