| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import shutil | 7 import shutil |
| 8 import sys | 8 import sys |
| 9 import subprocess | 9 import subprocess |
| 10 import tarfile | 10 import tarfile |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 if f.read() == version: | 32 if f.read() == version: |
| 33 return bin_location | 33 return bin_location |
| 34 | 34 |
| 35 # TODO(hinoka): This probably doesn't work that well on Windows... | 35 # TODO(hinoka): This probably doesn't work that well on Windows... |
| 36 shutil.rmtree(target_dir, ignore_errors=True) | 36 shutil.rmtree(target_dir, ignore_errors=True) |
| 37 | 37 |
| 38 # Get the target name correct. | 38 # Get the target name correct. |
| 39 if sys.platform == 'win32': | 39 if sys.platform == 'win32': |
| 40 target = 'node.exe' | 40 target = 'node.exe' |
| 41 elif sys.platform == 'darwin': | 41 elif sys.platform == 'darwin': |
| 42 target = 'node-v%s-darwin-x86.tar.gz' % version | 42 target = 'node-v%s-darwin-x64.tar.gz' % version |
| 43 elif sys.platform == 'linux2': | 43 elif sys.platform == 'linux2': |
| 44 target = 'node-v%s-linux-x86.tar.gz' % version | 44 target = 'node-v%s-linux-x86.tar.gz' % version |
| 45 else: | 45 else: |
| 46 raise Exception('Unrecognized platform %s' % sys.platform) | 46 raise Exception('Unrecognized platform %s' % sys.platform) |
| 47 | 47 |
| 48 dest = os.path.join(tmp_dir, 'node_download') | 48 dest = os.path.join(tmp_dir, 'node_download') |
| 49 url = 'https://storage.googleapis.com/%s/%s/%s' % ( | 49 url = 'https://storage.googleapis.com/%s/%s/%s' % ( |
| 50 BUCKET, version, target) | 50 BUCKET, version, target) |
| 51 print('Fetching %s' % url) | 51 print('Fetching %s' % url) |
| 52 u = urllib2.urlopen(url) | 52 u = urllib2.urlopen(url) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 if mode == 'npm': | 111 if mode == 'npm': |
| 112 # TODO(hinoka): How about Windows...? | 112 # TODO(hinoka): How about Windows...? |
| 113 bin_location = os.path.join(os.path.dirname(bin_location), 'npm') | 113 bin_location = os.path.join(os.path.dirname(bin_location), 'npm') |
| 114 | 114 |
| 115 return subprocess.call([bin_location, ] + sys.argv[1:]) | 115 return subprocess.call([bin_location, ] + sys.argv[1:]) |
| 116 | 116 |
| 117 | 117 |
| 118 if __name__ == '__main__': | 118 if __name__ == '__main__': |
| 119 sys.exit(main()) | 119 sys.exit(main()) |
| OLD | NEW |