| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # Copyright (c) 2010 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2010 The Native Client Authors. All rights reserved. | 
| 3 # Use of this source code is governed by a BSD-style license that be | 3 # Use of this source code is governed by a BSD-style license that be | 
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. | 
| 5 | 5 | 
| 6 """Build and install all the third-party tools and libraries required to build | 6 """Build and install all the third-party tools and libraries required to build | 
| 7 the SDK code.  To add a script, add it to the array |THIRD_PARTY_SCRIPTS|. | 7 the SDK code.  To add a script, add it to the array |THIRD_PARTY_SCRIPTS|. | 
| 8 Before running the scripts, a couple of environment variables get set: | 8 Before running the scripts, a couple of environment variables get set: | 
| 9   PYTHONPATH - append this script's dir to the search path for module import. | 9   PYTHONPATH - append this script's dir to the search path for module import. | 
| 10   NACL_SDK_ROOT - forced to point to the root of this repo. | 10   NACL_SDK_ROOT - forced to point to the root of this repo. | 
| 11 """ | 11 """ | 
| 12 | 12 | 
| 13 import os | 13 import os | 
| 14 import subprocess | 14 import subprocess | 
| 15 import sys | 15 import sys | 
| 16 | 16 | 
| 17 THIRD_PARTY_SCRIPTS = [ | 17 THIRD_PARTY_SCRIPTS = [ | 
| 18     os.path.join('install_gtest', 'install_gtest.py'), | 18     os.path.join('install_gtest', 'install_gtest.py'), | 
| 19     os.path.join('install_boost', 'install_boost.py'), | 19     os.path.join('install_boost', 'install_boost.py'), | 
| 20 ] | 20 ] | 
| 21 | 21 | 
| 22 | 22 | 
| 23 def main(argv): | 23 def main(argv): | 
| 24   # TODO(strotheide): This needs to work on windows, too.  See bug |  | 
| 25   # http://code.google.com/p/nativeclient/issues/detail?id=1122 |  | 
| 26   if sys.platform == 'win32': |  | 
| 27     print "NaCl SDK does not install third party packages on Windows." |  | 
| 28     sys.exit(0) |  | 
| 29 |  | 
| 30   script_dir = os.path.abspath(os.path.dirname(__file__)) | 24   script_dir = os.path.abspath(os.path.dirname(__file__)) | 
| 31   sep_char = ';' if sys.platform == 'win32' else ':' | 25   sep_char = ';' if sys.platform == 'win32' else ':' | 
| 32   os.putenv('PYTHONPATH', '%s%s%s' %(os.getenv('PYTHONPATH'), | 26   os.putenv('PYTHONPATH', '%s%s%s' %(os.getenv('PYTHONPATH'), | 
| 33                                      sep_char, | 27                                      sep_char, | 
| 34                                      script_dir)) | 28                                      script_dir)) | 
| 35   # Force NACL_SDK_ROOT to point to the toolchain in this repo. | 29   # Force NACL_SDK_ROOT to point to the toolchain in this repo. | 
| 36   (nacl_sdk_root, _) = os.path.split(script_dir) | 30   (nacl_sdk_root, _) = os.path.split(script_dir) | 
| 37   os.putenv('NACL_SDK_ROOT', nacl_sdk_root) | 31   os.putenv('NACL_SDK_ROOT', nacl_sdk_root) | 
| 38   for script in THIRD_PARTY_SCRIPTS: | 32   for script in THIRD_PARTY_SCRIPTS: | 
| 39     print "Running install script: %s" % os.path.join(script_dir, script) | 33     print "Running install script: %s" % os.path.join(script_dir, script) | 
| 40     py_command = ['%s %s' % (sys.executable, os.path.join(script_dir, script))] | 34     py_command = ['%s %s' % (sys.executable, os.path.join(script_dir, script))] | 
| 41     p = subprocess.Popen(py_command + argv, shell=True) | 35     p = subprocess.Popen(py_command + argv, shell=True) | 
| 42     assert p.wait() == 0 | 36     assert p.wait() == 0 | 
| 43 | 37 | 
| 44 | 38 | 
| 45 if __name__ == '__main__': | 39 if __name__ == '__main__': | 
| 46   main(sys.argv[1:]) | 40   main(sys.argv[1:]) | 
| OLD | NEW | 
|---|