aboutsummaryrefslogtreecommitdiff
path: root/get_common_image_version.py
diff options
context:
space:
mode:
Diffstat (limited to 'get_common_image_version.py')
-rwxr-xr-xget_common_image_version.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/get_common_image_version.py b/get_common_image_version.py
index cdac8006..bf5d219b 100755
--- a/get_common_image_version.py
+++ b/get_common_image_version.py
@@ -1,7 +1,6 @@
#!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
-
"""Script to find list of common images (first beta releases) in Chromeos.
Display information about stable ChromeOS/Chrome versions to be used
@@ -11,7 +10,7 @@ using randomly selected versions. Currently we define as a "stable"
version the first Beta release in a particular release cycle.
"""
-__author__ = "llozano@google.com (Luis Lozano)"
+__author__ = 'llozano@google.com (Luis Lozano)'
import optparse
import pickle
@@ -19,13 +18,13 @@ import re
import sys
import urllib
-VERSIONS_HISTORY_URL = "http://cros-omahaproxy.appspot.com/history"
+VERSIONS_HISTORY_URL = 'http://cros-omahaproxy.appspot.com/history'
def DisplayBetas(betas):
- print "List of betas from", VERSIONS_HISTORY_URL
+ print 'List of betas from', VERSIONS_HISTORY_URL
for beta in betas:
- print " Release", beta["chrome_major_version"], beta
+ print ' Release', beta['chrome_major_version'], beta
return
@@ -36,14 +35,14 @@ def FindAllBetas(all_versions):
prev_beta = {}
for line in all_versions:
match_obj = re.match(
- r"(?P<date>.*),(?P<chromeos_version>.*),"
- r"(?P<chrome_major_version>\d*).(?P<chrome_minor_version>.*),"
- r"(?P<chrome_appid>.*),beta-channel,,Samsung Chromebook Series 5 550",
+ r'(?P<date>.*),(?P<chromeos_version>.*),'
+ r'(?P<chrome_major_version>\d*).(?P<chrome_minor_version>.*),'
+ r'(?P<chrome_appid>.*),beta-channel,,Samsung Chromebook Series 5 550',
line)
if match_obj:
if prev_beta:
- if (prev_beta["chrome_major_version"] !=
- match_obj.group("chrome_major_version")):
+ if (prev_beta['chrome_major_version'] !=
+ match_obj.group('chrome_major_version')):
all_betas.append(prev_beta)
prev_beta = match_obj.groupdict()
if prev_beta:
@@ -52,9 +51,9 @@ def FindAllBetas(all_versions):
def SerializeBetas(all_betas, serialize_file):
- with open(serialize_file, "wb") as f:
+ with open(serialize_file, 'wb') as f:
pickle.dump(all_betas, f)
- print "Serialized list of betas into", serialize_file
+ print 'Serialized list of betas into', serialize_file
return
@@ -62,15 +61,17 @@ def Main(argv):
"""Get ChromeOS first betas list from history URL."""
parser = optparse.OptionParser()
- parser.add_option("--serialize", dest="serialize", default=None,
- help="Save list of common images into the specified file.")
+ parser.add_option('--serialize',
+ dest='serialize',
+ default=None,
+ help='Save list of common images into the specified file.')
options = parser.parse_args(argv)[0]
try:
opener = urllib.URLopener()
all_versions = opener.open(VERSIONS_HISTORY_URL)
except IOError as ioe:
- print "Cannot open", VERSIONS_HISTORY_URL
+ print 'Cannot open', VERSIONS_HISTORY_URL
print ioe
return 1
@@ -82,6 +83,7 @@ def Main(argv):
return 0
-if __name__ == "__main__":
+
+if __name__ == '__main__':
retval = Main(sys.argv)
sys.exit(retval)