1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Downloads items from the Chromium continuous archive."""
13 CHROME_30_REVISION
= '217281'
14 CHROME_31_REVISION
= '225096'
15 CHROME_32_REVISION
= '232870'
17 _SITE
= 'http://commondatastorage.googleapis.com'
21 CONTINUOUS
= _SITE
+ '/chromium-browser-continuous'
22 SNAPSHOT
= _SITE
+ '/chromium-browser-snapshots'
25 def GetLatestRevision(site
=Site
.CONTINUOUS
):
26 """Returns the latest revision (as a string) available for this platform.
29 site: the archive site to check against, default to the continuous one.
31 url
= site
+ '/%s/LAST_CHANGE'
32 return urllib
.urlopen(url
% _GetDownloadPlatform()).read()
35 def DownloadChrome(revision
, dest_dir
, site
=Site
.CONTINUOUS
):
36 """Downloads the packaged Chrome from the archive to the given directory.
39 revision: the revision of Chrome to download.
40 dest_dir: the directory to download Chrome to.
41 site: the archive site to download from, default to the continuous one.
44 The path to the unzipped Chrome binary.
53 def GetChromePathFromPackage():
57 return 'Chromium.app/Contents/MacOS/Chromium'
60 zip_path
= os
.path
.join(dest_dir
, 'chrome-%s.zip' % revision
)
61 if not os
.path
.exists(zip_path
):
62 url
= site
+ '/%s/%s/%s.zip' % (_GetDownloadPlatform(), revision
,
64 print 'Downloading', url
, '...'
65 urllib
.urlretrieve(url
, zip_path
)
66 util
.Unzip(zip_path
, dest_dir
)
67 return os
.path
.join(dest_dir
, GetZipName(), GetChromePathFromPackage())
70 def _GetDownloadPlatform():
71 """Returns the name for this platform on the archive site."""
77 if platform
.architecture()[0] == '64bit':