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_43_REVISION
= '323865'
14 CHROME_44_REVISION
= '330231'
15 CHROME_45_REVISION
= '338390'
17 _SITE
= 'http://commondatastorage.googleapis.com'
21 CONTINUOUS
= _SITE
+ '/chromium-browser-continuous'
22 CHROMIUM_SNAPSHOT
= _SITE
+ '/chromium-browser-snapshots'
23 BLINK_SNAPSHOT
= _SITE
+ '/chromium-webkit-snapshots'
26 def GetLatestRevision(site
=Site
.CONTINUOUS
):
27 """Returns the latest revision (as a string) available for this platform.
30 site: the archive site to check against, default to the continuous one.
32 url
= site
+ '/%s/LAST_CHANGE'
33 return urllib
.urlopen(url
% _GetDownloadPlatform()).read()
36 def DownloadChrome(revision
, dest_dir
, site
=Site
.CONTINUOUS
):
37 """Downloads the packaged Chrome from the archive to the given directory.
40 revision: the revision of Chrome to download.
41 dest_dir: the directory to download Chrome to.
42 site: the archive site to download from, default to the continuous one.
45 The path to the unzipped Chrome binary.
54 def GetChromePathFromPackage():
58 return 'Chromium.app/Contents/MacOS/Chromium'
60 return 'chrome-wrapper'
61 zip_path
= os
.path
.join(dest_dir
, 'chrome-%s.zip' % revision
)
62 if not os
.path
.exists(zip_path
):
63 url
= site
+ '/%s/%s/%s.zip' % (_GetDownloadPlatform(), revision
,
65 print 'Downloading', url
, '...'
66 urllib
.urlretrieve(url
, zip_path
)
67 util
.Unzip(zip_path
, dest_dir
)
68 return os
.path
.join(dest_dir
, GetZipName(), GetChromePathFromPackage())
71 def _GetDownloadPlatform():
72 """Returns the name for this platform on the archive site."""
78 if platform
.architecture()[0] == '64bit':
83 def GetLatestSnapshotVersion():
84 """Returns the latest revision of snapshot build."""
85 return GetLatestRevision(GetSnapshotDownloadSite())
87 def GetSnapshotDownloadSite():
88 """Returns the site to download snapshot build according to the platform."""
89 return Site
.CHROMIUM_SNAPSHOT