comparison mxtool/mx.py @ 8185:3bbdf34536bc

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 10 Mar 2013 19:51:32 +0100
parents 4b11a0983557
children 3c74a32bb262
comparison
equal deleted inserted replaced
8184:d982f1469cba 8185:3bbdf34536bc
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 zf = zipfile.ZipFile(d.path, 'w') 1654 fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(d.path) + '.', dir=dirname(d.path))
1655 zf = zipfile.ZipFile(tmp, 'w')
1655 for p in sorted_deps(d.deps): 1656 for p in sorted_deps(d.deps):
1656 outputDir = p.output_dir() 1657 outputDir = p.output_dir()
1657 for root, _, files in os.walk(outputDir): 1658 for root, _, files in os.walk(outputDir):
1658 for f in files: 1659 for f in files:
1659 relpath = root[len(outputDir) + 1:] 1660 relpath = root[len(outputDir) + 1:]
1660 arcname = join(relpath, f).replace(os.sep, '/') 1661 arcname = join(relpath, f).replace(os.sep, '/')
1661 zf.write(join(root, f), arcname) 1662 zf.write(join(root, f), arcname)
1662 zf.close() 1663 zf.close()
1664 os.close(fd)
1665 # Atomic on Unix
1666 shutil.move(tmp, d.path)
1667 #print time.time(), 'move:', tmp, '->', d.path
1663 d.notify_updated() 1668 d.notify_updated()
1664 1669
1665 else: 1670 else:
1666 p = project(name) 1671 p = project(name)
1667 outputDir = p.output_dir() 1672 outputDir = p.output_dir()
1668 jar = join(p.dir, p.name + '.jar') 1673 fd, tmp = tempfile.mkstemp(suffix='', prefix=p.name, dir=p.dir)
1669 zf = zipfile.ZipFile(jar, 'w') 1674 zf = zipfile.ZipFile(tmp, 'w')
1670 for root, _, files in os.walk(outputDir): 1675 for root, _, files in os.walk(outputDir):
1671 for f in files: 1676 for f in files:
1672 relpath = root[len(outputDir) + 1:] 1677 relpath = root[len(outputDir) + 1:]
1673 arcname = join(relpath, f).replace(os.sep, '/') 1678 arcname = join(relpath, f).replace(os.sep, '/')
1674 zf.write(join(root, f), arcname) 1679 zf.write(join(root, f), arcname)
1675 zf.close() 1680 zf.close()
1681 os.close(fd)
1682 # Atomic on Unix
1683 shutil.move(tmp, join(p.dir, p.name + '.jar'))
1676 1684
1677 def canonicalizeprojects(args): 1685 def canonicalizeprojects(args):
1678 """process all project files to canonicalize the dependencies 1686 """process all project files to canonicalize the dependencies
1679 1687
1680 The exit code of this command reflects how many files were updated.""" 1688 The exit code of this command reflects how many files were updated."""
2253 if p in deps: 2261 if p in deps:
2254 return True 2262 return True
2255 2263
2256 return False 2264 return False
2257 2265
2258 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False): 2266 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False, logToConsole=False):
2259 launchOut = XMLDoc(); 2267 launchOut = XMLDoc();
2268 consoleOn = 'true' if logToConsole else 'false'
2260 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) 2269 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'})
2270 launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'})
2271 launchOut.element('mapEntry', {'key' : 'JAVA_HOME', 'value' : java().jdk})
2272 launchOut.close('mapAttribute')
2273
2261 if refresh: 2274 if refresh:
2262 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'}) 2275 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'})
2263 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': 'false'}) 2276 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn})
2264 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': 'false'}) 2277 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': consoleOn})
2265 if async: 2278 if async:
2266 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true'}) 2279 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true'})
2267 2280
2268 baseDir = dirname(dirname(os.path.abspath(__file__))) 2281 baseDir = dirname(dirname(os.path.abspath(__file__)))
2269 2282