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 datetime | 8 import datetime |
9 import glob | 9 import glob |
10 import os | 10 import os |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 def main(): | 133 def main(): |
134 usage = 'usage: %prog -t <target_dir>' | 134 usage = 'usage: %prog -t <target_dir>' |
135 parser = OptionParser(usage) | 135 parser = OptionParser(usage) |
136 parser.add_option('-t', '--target-dir', | 136 parser.add_option('-t', '--target-dir', |
137 help=('Target directory to put the downloaded and extracted' | 137 help=('Target directory to put the downloaded and extracted' |
138 ' folder with the Firefox Nightly build in.')) | 138 ' folder with the Firefox Nightly build in.')) |
139 parser.add_option('-f', '--force', action='store_true', | 139 parser.add_option('-f', '--force', action='store_true', |
140 help=('Force download even if the current nightly is ' | 140 help=('Force download even if the current nightly is ' |
141 'already downloaded.')) | 141 'already downloaded.')) |
142 parser.add_option('-c', '--clean-old-archives', action='store_true', | 142 parser.add_option('-c', '--clean-old-firefox-archives', action='store_true', |
143 help=('Clean old firefox archives; one will always be ' | 143 help=('Clean old firefox archives; one will always be ' |
144 'kept as a fallback.')) | 144 'kept as a fallback.')) |
145 options, _args = parser.parse_args() | 145 options, _args = parser.parse_args() |
146 if not options.target_dir: | 146 if not options.target_dir: |
147 parser.error('You must specify the target directory.') | 147 parser.error('You must specify the target directory.') |
148 | 148 |
149 target_dir = options.target_dir | 149 target_dir = options.target_dir |
150 if not os.path.isdir(target_dir): | 150 if not os.path.isdir(target_dir): |
151 os.mkdir(target_dir) | 151 os.mkdir(target_dir) |
152 | 152 |
153 firefox_archive = _MaybeDownload(target_dir, options.force) | 153 firefox_archive = _MaybeDownload(target_dir, options.force) |
154 if firefox_archive: | 154 if firefox_archive: |
155 return _ExtractArchive(firefox_archive, target_dir) | 155 return _ExtractArchive(firefox_archive, target_dir) |
156 | 156 |
157 if options.clean_old_archives: | 157 if options.clean_old_archives: |
158 _CleanOldFirefoxArchives(target_dir) | 158 _CleanOldFirefoxArchives(target_dir) |
159 | 159 |
160 if __name__ == '__main__': | 160 if __name__ == '__main__': |
161 sys.exit(main()) | 161 sys.exit(main()) |
OLD | NEW |