OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Downloads a Firefox Nightly build for the current platform.""" | 6 """Downloads a Firefox Nightly build for the current platform.""" |
7 | 7 |
8 import os | 8 import os |
9 import shutil | 9 import shutil |
10 import sys | 10 import sys |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 downloader.build_filename(downloader.binary)) | 45 downloader.build_filename(downloader.binary)) |
46 | 46 |
47 if os.path.exists(firefox_archive) and not options.force: | 47 if os.path.exists(firefox_archive) and not options.force: |
48 print 'Skipping download as %s is already downloaded.' % firefox_archive | 48 print 'Skipping download as %s is already downloaded.' % firefox_archive |
49 return 0 | 49 return 0 |
50 | 50 |
51 downloader.download() | 51 downloader.download() |
52 print 'Downloaded %s' % firefox_archive | 52 print 'Downloaded %s' % firefox_archive |
53 | 53 |
54 # Extract the archive. | 54 # Extract the archive. |
| 55 # TODO(phoglund): implement on win/mac |
55 if sys.platform == 'darwin': | 56 if sys.platform == 'darwin': |
| 57 print "Temporarily disabled on mac..." |
| 58 return 0 |
56 volume = '/Volumes/Nightly' | 59 volume = '/Volumes/Nightly' |
57 firefox_executable = '%s/FirefoxNightly.app' % target_dir | 60 firefox_executable = '%s/FirefoxNightly.app' % target_dir |
58 | 61 |
59 # Unmount any previous downloads. | 62 # Unmount any previous downloads. |
60 subprocess.call(['hdiutil', 'detach', volume]) | 63 subprocess.call(['hdiutil', 'detach', volume]) |
61 | 64 |
62 subprocess.check_call(['hdiutil', 'attach', firefox_archive]) | 65 subprocess.check_call(['hdiutil', 'attach', firefox_archive]) |
63 shutil.copytree('%s/FirefoxNightly.app' % volume, firefox_executable) | 66 shutil.copytree('%s/FirefoxNightly.app' % volume, firefox_executable) |
64 subprocess.check_call(['hdiutil', 'detach', volume]) | 67 subprocess.check_call(['hdiutil', 'detach', volume]) |
65 elif sys.platform == 'linux2': | 68 elif sys.platform == 'linux2': |
66 tar_archive = tarfile.open(firefox_archive, 'r:bz2') | 69 tar_archive = tarfile.open(firefox_archive, 'r:bz2') |
67 tar_archive.extractall(path=target_dir) | 70 tar_archive.extractall(path=target_dir) |
68 elif sys.platform == 'win32': | 71 elif sys.platform == 'win32': |
| 72 print "Temporarily disabled on win..." |
| 73 return 0 |
69 zip_archive = zipfile.ZipFile(firefox_archive) | 74 zip_archive = zipfile.ZipFile(firefox_archive) |
70 zip_archive.extractall(path=target_dir) | 75 zip_archive.extractall(path=target_dir) |
71 else: | 76 else: |
72 print >> sys.stderr, 'Unsupported platform: %s' % sys.platform | 77 print >> sys.stderr, 'Unsupported platform: %s' % sys.platform |
73 return 1 | 78 return 1 |
74 | 79 |
75 print 'Extracted %s' % firefox_archive | 80 print 'Extracted %s' % firefox_archive |
76 return 0 | 81 return 0 |
77 | 82 |
78 if __name__ == '__main__': | 83 if __name__ == '__main__': |
79 sys.exit(main()) | 84 sys.exit(main()) |
OLD | NEW |