# HG changeset patch # User Doug Simon # Date 1362758266 -3600 # Node ID 4b11a0983557c039214bd05ffe1412b23199f473 # Parent e0db99483b354199e3c3124bc732bcfe0e7743f5 fixed issue with deleting temp files on Windows diff -r e0db99483b35 -r 4b11a0983557 mx/commands.py --- 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 diff -r e0db99483b35 -r 4b11a0983557 mxtool/mx.py --- 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')