| OLD | NEW |
| 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
| 6 # scripts. | 6 # scripts. |
| 7 | 7 |
| 8 import commands | 8 import commands |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 | 294 |
| 295 def ConfigureJava(): | 295 def ConfigureJava(): |
| 296 java_home = '/usr/libexec/java_home' | 296 java_home = '/usr/libexec/java_home' |
| 297 if os.path.exists(java_home): | 297 if os.path.exists(java_home): |
| 298 proc = subprocess.Popen([java_home, '-v', '1.6+'], | 298 proc = subprocess.Popen([java_home, '-v', '1.6+'], |
| 299 stdout=subprocess.PIPE, | 299 stdout=subprocess.PIPE, |
| 300 stderr=subprocess.PIPE) | 300 stderr=subprocess.PIPE) |
| 301 (stdout, stderr) = proc.communicate() | 301 (stdout, stderr) = proc.communicate() |
| 302 if proc.wait() != 0: | 302 if proc.wait() != 0: |
| 303 raise ToolError('non-zero exit code from ' + java_home) | 303 return None |
| 304 new = stdout.strip() | 304 new = stdout.strip() |
| 305 current = os.getenv('JAVA_HOME', default=new) | 305 current = os.getenv('JAVA_HOME', default=new) |
| 306 if current != new: | 306 if current != new: |
| 307 sys.stderr.write('Please set JAVA_HOME to %s\n' % new) | 307 sys.stderr.write('Please set JAVA_HOME to %s\n' % new) |
| 308 os.putenv('JAVA_HOME', new) | 308 os.putenv('JAVA_HOME', new) |
| 309 | 309 |
| 310 | 310 |
| 311 def Daemonize(): | 311 def Daemonize(): |
| 312 """ | 312 """ |
| 313 Create a detached background process (daemon). Returns True for | 313 Create a detached background process (daemon). Returns True for |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 def DartSdkBinary(): | 395 def DartSdkBinary(): |
| 396 tools_dir = os.path.dirname(os.path.realpath(__file__)) | 396 tools_dir = os.path.dirname(os.path.realpath(__file__)) |
| 397 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin') | 397 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin') |
| 398 return os.path.join(dart_binary_prefix, 'dart') | 398 return os.path.join(dart_binary_prefix, 'dart') |
| 399 | 399 |
| 400 | 400 |
| 401 if __name__ == "__main__": | 401 if __name__ == "__main__": |
| 402 import sys | 402 import sys |
| 403 Main(sys.argv) | 403 Main(sys.argv) |
| OLD | NEW |