Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 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 | 3c74a32bb262 |
comparison
equal
deleted
inserted
replaced
8182:e0db99483b35 | 8183:4b11a0983557 |
---|---|
1649 | 1649 |
1650 for name in args.names: | 1650 for name in args.names: |
1651 if name.startswith('@'): | 1651 if name.startswith('@'): |
1652 dname = name[1:] | 1652 dname = name[1:] |
1653 d = distribution(dname) | 1653 d = distribution(dname) |
1654 _, tmp = tempfile.mkstemp(suffix='', prefix=basename(d.path), dir=dirname(d.path)) | 1654 fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(d.path) + '.', dir=dirname(d.path)) |
1655 zf = zipfile.ZipFile(tmp, 'w') | 1655 zf = zipfile.ZipFile(tmp, 'w') |
1656 for p in sorted_deps(d.deps): | 1656 for p in sorted_deps(d.deps): |
1657 outputDir = p.output_dir() | 1657 outputDir = p.output_dir() |
1658 for root, _, files in os.walk(outputDir): | 1658 for root, _, files in os.walk(outputDir): |
1659 for f in files: | 1659 for f in files: |
1660 relpath = root[len(outputDir) + 1:] | 1660 relpath = root[len(outputDir) + 1:] |
1661 arcname = join(relpath, f).replace(os.sep, '/') | 1661 arcname = join(relpath, f).replace(os.sep, '/') |
1662 zf.write(join(root, f), arcname) | 1662 zf.write(join(root, f), arcname) |
1663 zf.close() | 1663 zf.close() |
1664 os.close(fd) | |
1664 # Atomic on Unix | 1665 # Atomic on Unix |
1665 shutil.move(tmp, d.path) | 1666 shutil.move(tmp, d.path) |
1666 #print time.time(), 'move:', tmp, '->', d.path | 1667 #print time.time(), 'move:', tmp, '->', d.path |
1667 d.notify_updated() | 1668 d.notify_updated() |
1668 | 1669 |
1669 else: | 1670 else: |
1670 p = project(name) | 1671 p = project(name) |
1671 outputDir = p.output_dir() | 1672 outputDir = p.output_dir() |
1672 _, tmp = tempfile.mkstemp(suffix='', prefix=p.name, dir=p.dir) | 1673 fd, tmp = tempfile.mkstemp(suffix='', prefix=p.name, dir=p.dir) |
1673 zf = zipfile.ZipFile(tmp, 'w') | 1674 zf = zipfile.ZipFile(tmp, 'w') |
1674 for root, _, files in os.walk(outputDir): | 1675 for root, _, files in os.walk(outputDir): |
1675 for f in files: | 1676 for f in files: |
1676 relpath = root[len(outputDir) + 1:] | 1677 relpath = root[len(outputDir) + 1:] |
1677 arcname = join(relpath, f).replace(os.sep, '/') | 1678 arcname = join(relpath, f).replace(os.sep, '/') |
1678 zf.write(join(root, f), arcname) | 1679 zf.write(join(root, f), arcname) |
1679 zf.close() | 1680 zf.close() |
1681 os.close(fd) | |
1680 # Atomic on Unix | 1682 # Atomic on Unix |
1681 shutil.move(tmp, join(p.dir, p.name + '.jar')) | 1683 shutil.move(tmp, join(p.dir, p.name + '.jar')) |
1682 | 1684 |
1683 def canonicalizeprojects(args): | 1685 def canonicalizeprojects(args): |
1684 """process all project files to canonicalize the dependencies | 1686 """process all project files to canonicalize the dependencies |
2182 _genEclipseBuilder(out, p, 'Jar.launch', 'archive ' + p.name, refresh = False, async = False) | 2184 _genEclipseBuilder(out, p, 'Jar.launch', 'archive ' + p.name, refresh = False, async = False) |
2183 _genEclipseBuilder(out, p, 'Refresh.launch', '', refresh = True, async = True) | 2185 _genEclipseBuilder(out, p, 'Refresh.launch', '', refresh = True, async = True) |
2184 | 2186 |
2185 if projToDist.has_key(p.name): | 2187 if projToDist.has_key(p.name): |
2186 dist, distDeps = projToDist[p.name] | 2188 dist, distDeps = projToDist[p.name] |
2187 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist.launch', 'archive @' + dist.name, refresh=False, async=True, logToConsole=True) | 2189 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist.launch', 'archive @' + dist.name, refresh=False, async=True) |
2188 | 2190 |
2189 out.close('buildSpec') | 2191 out.close('buildSpec') |
2190 out.open('natures') | 2192 out.open('natures') |
2191 out.element('nature', data='org.eclipse.jdt.core.javanature') | 2193 out.element('nature', data='org.eclipse.jdt.core.javanature') |
2192 if exists(csConfig): | 2194 if exists(csConfig): |