Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: download_firefox_nightly.py

Issue 114293002: Adding support for launching firefox from webrtc.DEPS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webrtc/webrtc.DEPS/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « DEPS ('k') | run_firefox_webrtc.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 """Downloads a Firefox Nightly build for the current platform."""
7
8 import os
9 import shutil
10 import sys
11 import subprocess
12 import tarfile
13 import zipfile
14
15 from optparse import OptionParser
16
17 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
18 THIRD_PARTY_DIR = os.path.abspath(os.path.join(BASE_DIR, 'third_party'))
19
20 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozdownload'))
21 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozinfo'))
22
23 from mozdownload import scraper
24
25
26 def main():
27 usage = 'usage: %prog -t <target_dir>'
28 parser = OptionParser(usage)
29 parser.add_option('-t', '--target-dir',
30 help=('Target directory to put the downloaded and extracted'
31 ' folder with the Firefox Nightly build in.'))
32 parser.add_option('-f', '--force', action='store_true',
33 help=('Force download even if the current nightly is '
34 'already downloaded.'))
35 options, _args = parser.parse_args()
36 if not options.target_dir:
37 parser.error('You must specify the target directory.')
38
39 target_dir = options.target_dir
40 if not os.path.isdir(target_dir):
41 os.mkdir(target_dir)
42
43 downloader = scraper.DailyScraper(directory=target_dir, version=None)
44 firefox_archive = os.path.join(target_dir,
45 downloader.build_filename(downloader.binary))
46
47 if os.path.exists(firefox_archive) and not options.force:
48 print 'Skipping download as %s is already downloaded.' % firefox_archive
49 return 0
50
51 downloader.download()
52 print 'Downloaded %s' % firefox_archive
53
54 # Extract the archive.
55 if sys.platform == 'darwin':
56 volume = '/Volumes/Nightly'
57 firefox_executable = '%s/FirefoxNightly.app' % target_dir
58
59 # Unmount any previous downloads.
60 subprocess.call(['hdiutil', 'detach', volume])
61
62 subprocess.check_call(['hdiutil', 'attach', firefox_archive])
63 shutil.copytree('%s/FirefoxNightly.app' % volume, firefox_executable)
64 subprocess.check_call(['hdiutil', 'detach', volume])
65 elif sys.platform == 'linux2':
66 tar_archive = tarfile.open(firefox_archive, 'r:bz2')
67 tar_archive.extractall(path=target_dir)
68 elif sys.platform == 'win32':
69 zip_archive = zipfile.ZipFile(firefox_archive)
70 zip_archive.extractall(path=target_dir)
71 else:
72 print >> sys.stderr, 'Unsupported platform: %s' % sys.platform
73 return 1
74
75 print 'Extracted %s' % firefox_archive
76 return 0
77
78 if __name__ == '__main__':
79 sys.exit(main())
OLDNEW
« no previous file with comments | « DEPS ('k') | run_firefox_webrtc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698