Mercurial > hg > truffle
comparison mx/mx_graal.py @ 13919:9d70445ea369
mx: set correct permissions for graal.jar
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 10 Feb 2014 13:51:20 +0100 |
parents | 1e72cd05b77e |
children | c4e5a685c6a1 |
comparison
equal
deleted
inserted
replaced
13918:22bf5a8ba9eb | 13919:9d70445ea369 |
---|---|
79 | 79 |
80 _make_eclipse_launch = False | 80 _make_eclipse_launch = False |
81 | 81 |
82 _minVersion = mx.VersionSpec('1.7.0_04') | 82 _minVersion = mx.VersionSpec('1.7.0_04') |
83 | 83 |
84 JDK_UNIX_PERMISSIONS = 0755 | |
85 | |
84 def _get_vm(): | 86 def _get_vm(): |
85 """ | 87 """ |
86 Gets the configured VM, presenting a dialogue if there is no currently configured VM. | 88 Gets the configured VM, presenting a dialogue if there is no currently configured VM. |
87 """ | 89 """ |
88 global _vm | 90 global _vm |
322 else: | 324 else: |
323 jvmCfgLines += [line] | 325 jvmCfgLines += [line] |
324 | 326 |
325 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg | 327 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
326 if mx.get_os() != 'windows': | 328 if mx.get_os() != 'windows': |
327 chmodRecursive(jdk, 0755) | 329 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS) |
328 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'original')) | 330 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'original')) |
329 | 331 |
330 | 332 |
331 with open(jvmCfg, 'w') as fp: | 333 with open(jvmCfg, 'w') as fp: |
332 for line in jvmCfgLines: | 334 for line in jvmCfgLines: |
400 if exists(jreLibDir): | 402 if exists(jreLibDir): |
401 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE | 403 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE |
402 fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir) | 404 fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir) |
403 shutil.copyfile(graalJar, tmp) | 405 shutil.copyfile(graalJar, tmp) |
404 os.close(fd) | 406 os.close(fd) |
405 shutil.move(tmp, join(jreLibDir, 'graal.jar')) | 407 graalJar = join(jreLibDir, 'graal.jar') |
408 shutil.move(tmp, graalJar) | |
409 os.chmod(graalJar, JDK_UNIX_PERMISSIONS) | |
406 | 410 |
407 # run a command in the windows SDK Debug Shell | 411 # run a command in the windows SDK Debug Shell |
408 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): | 412 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): |
409 if respondTo is None: | 413 if respondTo is None: |
410 respondTo = {} | 414 respondTo = {} |
566 continue | 570 continue |
567 | 571 |
568 vmDir = join(_vmLibDirInJdk(jdk), vm) | 572 vmDir = join(_vmLibDirInJdk(jdk), vm) |
569 if not exists(vmDir): | 573 if not exists(vmDir): |
570 if mx.get_os() != 'windows': | 574 if mx.get_os() != 'windows': |
571 chmodRecursive(jdk, 0755) | 575 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS) |
572 mx.log('Creating VM directory in JDK7: ' + vmDir) | 576 mx.log('Creating VM directory in JDK7: ' + vmDir) |
573 os.makedirs(vmDir) | 577 os.makedirs(vmDir) |
574 | 578 |
575 def filterXusage(line): | 579 def filterXusage(line): |
576 if not 'Xusage.txt' in line: | 580 if not 'Xusage.txt' in line: |
683 lines.append(line) | 687 lines.append(line) |
684 | 688 |
685 if not found: | 689 if not found: |
686 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) | 690 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) |
687 if mx.get_os() != 'windows': | 691 if mx.get_os() != 'windows': |
688 os.chmod(jvmCfg, 0755) | 692 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS) |
689 with open(jvmCfg, 'w') as f: | 693 with open(jvmCfg, 'w') as f: |
690 for line in lines: | 694 for line in lines: |
691 if line.startswith(prefix): | 695 if line.startswith(prefix): |
692 line = vmKnown | 696 line = vmKnown |
693 found = True | 697 found = True |