Mercurial > hg > truffle
comparison mxtool/mx.py @ 14153:e328f28f7401
fix for mx, did not compile on Windows
author | Christian Wirth <christian.wirth@oracle.com> |
---|---|
date | Wed, 12 Mar 2014 11:23:56 +0100 |
parents | 38c0db058dcd |
children | e666c172c9aa |
comparison
equal
deleted
inserted
replaced
14152:42013bd831d6 | 14153:e328f28f7401 |
---|---|
354 def _writesha1Cached(): | 354 def _writesha1Cached(): |
355 with open(sha1path, 'w') as f: | 355 with open(sha1path, 'w') as f: |
356 f.write(_sha1OfFile()) | 356 f.write(_sha1OfFile()) |
357 | 357 |
358 def _sha1OfFile(): | 358 def _sha1OfFile(): |
359 with open(path, 'r') as f: | 359 with open(path, 'rb') as f: |
360 return hashlib.sha1(f.read()).hexdigest() | 360 return hashlib.sha1(f.read()).hexdigest() |
361 | 361 |
362 | 362 |
363 if resolve and mustExist and not exists(path): | 363 if resolve and mustExist and not exists(path): |
364 assert not len(urls) == 0, 'cannot find required library ' + name + ' ' + path | 364 assert not len(urls) == 0, 'cannot find required library ' + name + ' ' + path |
1091 return _java | 1091 return _java |
1092 | 1092 |
1093 def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True): | 1093 def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True): |
1094 return run(java().format_cmd(args, addDefaultArgs), nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd) | 1094 return run(java().format_cmd(args, addDefaultArgs), nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd) |
1095 | 1095 |
1096 def _kill_process_group(pid, sig=signal.SIGKILL): | 1096 def _kill_process_group(pid, sig): |
1097 pgid = os.getpgid(pid) | 1097 pgid = os.getpgid(pid) |
1098 try: | 1098 try: |
1099 os.killpg(pgid, sig) | 1099 os.killpg(pgid, sig) |
1100 return True | 1100 return True |
1101 except: | 1101 except: |
1496 p, _ = _currentSubprocess | 1496 p, _ = _currentSubprocess |
1497 if p is not None: | 1497 if p is not None: |
1498 if get_os() == 'windows': | 1498 if get_os() == 'windows': |
1499 p.kill() | 1499 p.kill() |
1500 else: | 1500 else: |
1501 _kill_process_group(p.pid) | 1501 _kill_process_group(p.pid, signal.SIGKILL) |
1502 | 1502 |
1503 raise SystemExit(codeOrMessage) | 1503 raise SystemExit(codeOrMessage) |
1504 | 1504 |
1505 def download(path, urls, verbose=False): | 1505 def download(path, urls, verbose=False): |
1506 """ | 1506 """ |
4086 abort(1) | 4086 abort(1) |
4087 signal.signal(signal.SIGTERM, term_handler) | 4087 signal.signal(signal.SIGTERM, term_handler) |
4088 | 4088 |
4089 def quit_handler(signum, frame): | 4089 def quit_handler(signum, frame): |
4090 _send_sigquit() | 4090 _send_sigquit() |
4091 signal.signal(signal.SIGQUIT, quit_handler) | 4091 if get_os() != 'windows': |
4092 signal.signal(signal.SIGQUIT, quit_handler) | |
4092 | 4093 |
4093 try: | 4094 try: |
4094 if opts.timeout != 0: | 4095 if opts.timeout != 0: |
4095 def alarm_handler(signum, frame): | 4096 def alarm_handler(signum, frame): |
4096 abort('Command timed out after ' + str(opts.timeout) + ' seconds: ' + ' '.join(commandAndArgs)) | 4097 abort('Command timed out after ' + str(opts.timeout) + ' seconds: ' + ' '.join(commandAndArgs)) |